fix: analytics graph memoizing
This commit is contained in:
parent
4015e23d34
commit
35c81ce112
3 changed files with 12 additions and 5 deletions
|
|
@ -14,7 +14,7 @@ export default {
|
|||
},
|
||||
select: {
|
||||
width: WIDTH,
|
||||
zIndex: 2,
|
||||
zIndex: 1,
|
||||
'& label': {
|
||||
extend: label1,
|
||||
color: offColor,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ const Graph = ({
|
|||
timezone,
|
||||
setSelectionCoords,
|
||||
setSelectionData,
|
||||
setSelectionDateInterval
|
||||
setSelectionDateInterval,
|
||||
selectedMachine
|
||||
}) => {
|
||||
const ref = useRef(null)
|
||||
|
||||
|
|
@ -428,5 +429,6 @@ export default memo(
|
|||
Graph,
|
||||
(prev, next) =>
|
||||
R.equals(prev.period, next.period) &&
|
||||
R.equals(prev.selectedDay, next.selectedDay)
|
||||
R.equals(prev.selectedDay, next.selectedDay) &&
|
||||
R.equals(prev.selectedMachine, next.selectedMachine)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
fontSecondary
|
||||
} from 'src/styling/variables'
|
||||
|
||||
const Graph = ({ data, machines, currency }) => {
|
||||
const Graph = ({ data, machines, currency, selectedMachine }) => {
|
||||
const ref = useRef(null)
|
||||
|
||||
const AMOUNT_OF_MACHINES = 5
|
||||
|
|
@ -304,4 +304,9 @@ const Graph = ({ data, machines, currency }) => {
|
|||
return <svg ref={ref} />
|
||||
}
|
||||
|
||||
export default memo(Graph, (prev, next) => R.equals(prev.period, next.period))
|
||||
export default memo(
|
||||
Graph,
|
||||
(prev, next) =>
|
||||
R.equals(prev.period, next.period) &&
|
||||
R.equals(prev.selectedMachine, next.selectedMachine)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue