Skip to content

Commit cb88178

Browse files
authored
CODAP-1010 Make graph respond immediately to change in background color (#2266)
* [#CODAP-1010] Bug fix: The user can change the background color of a graph * It turned out that the only problem was that the graph was not immediately responding to the change in background color. But it was already displaying the new color on redisplay. So the solution is to expand the accessor of the `mstReaction` installed in `Background` to include the `plotBackgroundColor` property. * * Code review tweak
1 parent a487271 commit cb88178

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

v3/src/components/data-display/components/background.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ export const Background = forwardRef<SVGGElement | HTMLDivElement, IProps>((prop
274274
)
275275
}, [renderBackground, dataDisplayModel])
276276

277-
useEffect(function respondToChangeInImage() {
278-
mstReaction(() => dataDisplayModel?.plotBackgroundImage,
277+
useEffect(function respondToBackgroundOrImageChange() {
278+
mstReaction(() => [dataDisplayModel?.plotBackgroundImage, dataDisplayModel?.plotBackgroundColor],
279279
() => {
280280
renderBackground()
281-
}, {name: "renderBackground", fireImmediately: true}, dataDisplayModel
281+
}, {name: "renderBackground", equals: comparer.structural, fireImmediately: true}, dataDisplayModel
282282
)
283283
}, [dataDisplayModel, renderBackground])
284284

0 commit comments

Comments
 (0)