[Feature] Add possibility to listen on displayOptions changes#142
Open
matystl wants to merge 1 commit intoAPIs-guru:mainfrom
Open
[Feature] Add possibility to listen on displayOptions changes#142matystl wants to merge 1 commit intoAPIs-guru:mainfrom
matystl wants to merge 1 commit intoAPIs-guru:mainfrom
Conversation
| this.displayOptions[key] = JSON.parse(value); | ||
| } catch (_) { | ||
| console.log( | ||
| 'Not expected value for key "', |
Member
There was a problem hiding this comment.
Can you please use a template string here?
| }, | ||
| body: JSON.stringify({ query: introspectionQuery }), | ||
| ...(withCredentials === 'true' ? { credentials: 'include', mode: 'cors' } : {}), | ||
| }).then(response => response.json()); |
Member
There was a problem hiding this comment.
Can you please run prettier on these files as a separate PR?
It would way easier to review this PR and will keep commit history clean.
Contributor
Author
There was a problem hiding this comment.
Created PR #143 and will rebase this it after it will be merged
ac97d33 to
9cb44d0
Compare
9cb44d0 to
2c7db46
Compare
Contributor
Author
|
@IvanGoncharov reminder for this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
rootTypedoesn't exist it will break instead of not honoring that setting. It has almost nothing with this PR but as soon as user hasrootTypein 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.