[Feature] Add possibility to listen on displayOptions changes #142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: currently as user i can set displayOptions when voyager is initialized. But there is no option to listen on changes when user change this settings. That means it is really hard to implement persistence of settings in query prams or localstorage.
Solution: Add to props callback function that will be called on every user settings change. Also i added to demo folder how it can be persisted in query params.
Possibly fixes issues: #107 #103 #12
Small problem: When voyager is loaded and provided
rootType
doesn't exist it will break instead of not honoring that setting. It has almost nothing with this PR but as soon as user hasrootType
in query params it happens more often and it is not quite straightforward that he should just delete query params to fix problem and make everithing working. But as library(builded version) no setting in query params is implemented and is up to users to implemented so it could probably be fixed later.