graphql-voyager
graphql-voyager copied to clipboard
[Feature] Add possibility to listen on displayOptions changes
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: https://github.com/APIs-guru/graphql-voyager/issues/107 https://github.com/APIs-guru/graphql-voyager/issues/103 https://github.com/APIs-guru/graphql-voyager/issues/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 has rootType
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.
@IvanGoncharov reminder for this