Merge pull request #1102 from chaotixkilla/fix-analytics-page-graphs-memo
Fix analytics page graphs memoizing
This commit is contained in:
commit
fee6f64ac6
3 changed files with 12 additions and 5 deletions
|
|
@ -14,7 +14,7 @@ export default {
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
width: WIDTH,
|
width: WIDTH,
|
||||||
zIndex: 2,
|
zIndex: 1,
|
||||||
'& label': {
|
'& label': {
|
||||||
extend: label1,
|
extend: label1,
|
||||||
color: offColor,
|
color: offColor,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ const Graph = ({
|
||||||
timezone,
|
timezone,
|
||||||
setSelectionCoords,
|
setSelectionCoords,
|
||||||
setSelectionData,
|
setSelectionData,
|
||||||
setSelectionDateInterval
|
setSelectionDateInterval,
|
||||||
|
selectedMachine
|
||||||
}) => {
|
}) => {
|
||||||
const ref = useRef(null)
|
const ref = useRef(null)
|
||||||
|
|
||||||
|
|
@ -428,5 +429,6 @@ export default memo(
|
||||||
Graph,
|
Graph,
|
||||||
(prev, next) =>
|
(prev, next) =>
|
||||||
R.equals(prev.period, next.period) &&
|
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
|
fontSecondary
|
||||||
} from 'src/styling/variables'
|
} from 'src/styling/variables'
|
||||||
|
|
||||||
const Graph = ({ data, machines, currency }) => {
|
const Graph = ({ data, machines, currency, selectedMachine }) => {
|
||||||
const ref = useRef(null)
|
const ref = useRef(null)
|
||||||
|
|
||||||
const AMOUNT_OF_MACHINES = 5
|
const AMOUNT_OF_MACHINES = 5
|
||||||
|
|
@ -304,4 +304,9 @@ const Graph = ({ data, machines, currency }) => {
|
||||||
return <svg ref={ref} />
|
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