-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
[Feature] Add possibility to listen on displayOptions changes #142
base: main
Are you sure you want to change the base?
Conversation
demo/index.tsx
Outdated
this.displayOptions[key] = JSON.parse(value); | ||
} catch (_) { | ||
console.log( | ||
'Not expected value for key "', |
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.
Can you please use a template string here?
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.
fixed
demo/index.tsx
Outdated
}, | ||
body: JSON.stringify({ query: introspectionQuery }), | ||
...(withCredentials === 'true' ? { credentials: 'include', mode: 'cors' } : {}), | ||
}).then(response => response.json()); |
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.
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.
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.
Created PR #143 and will rebase this it after it will be merged
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.
rebased
ac97d33
to
9cb44d0
Compare
9cb44d0
to
2c7db46
Compare
@IvanGoncharov reminder for this |
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.