-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: narrative dataset filters #1493
Conversation
Nice find on the 🐛 @joverlee521! Notes looking at the codepaths involved here as part of review:
controls = cloneDeep(oldState.controls);
controls = restoreQueryableStateToDefaults(controls); # only ever called here
controls = modifyStateViaURLQuery(controls, query);
The root cause of the bug is in controls = restoreQueryableStateToDefaults(controls);
controls = modifyStateViaMetadata(controls, metadata); # add this line However a better fix would be (might be?) to rewrite |
Thanks for writing out the codepath notes @jameshadfield, it's really helpful to see it all! I'm in favor of just doing the 1-line change of adding |
@jameshadfield pointed out in review that `filtersInFooter` was missing from the default control states.
When users change to a slide in a narrative that has the same dataset as the previous slide, `restoreQueryableStateToDefaults` resets controls to the _app_ default state which updates the filters state to an empty object. This leads to the bug described in #1492. Calling `modifyStateViaMetadata` after `restoreQueryableStateToDefaults` ensures that all _dataset_ default controls are restored as well. Resolves #1492.
c64f2b4
to
aa00480
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joverlee521!
When users change the slide in a narrative, the controls state gets
reset to its default state which updates the filters state to an empty
object. This leads to the bug described in #1492.
This commit extracts the filters creation frommodifyStateViaMetadata
into its own function so that it can be reused to recreate the filters
when users change the slide within a narrative.
Resolves #1492.