-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add Refresh ability on the Gallery & Toolbar #784
Conversation
Adds a new `handleRefreshPage` method to AssetAdmin JS which is then passed into the `Gallery` component and from there the `GalleryToolbar` It works by passing updating the variables passed via GraphQL to include a random `cache_buster`. Just asking it to make the same request again doesn't work as the variables are the same so the response was being returned from an internal cache in the apollo-client
Requires: silverstripe/silverstripe-asset-admin#784 which adds the ability to refresh a page
Hiya @unclecheese, @flamerohr |
Hi, @oilee80. This seems to be a domain-specific concern related to your Cloudinary module. What you can do, ideally on the 4.2 release, is add this behaviour with Injector. The Gallery toolbar is now extensible due to @blueo 's work, and you can add arbitrary actions into it. Further, with SS 4.2 now shipping with Apollo 2.5, you'll be afforded a better API for refreshing query state rather than using a Either myself or @flamerohr can help you out with that in a separate discussion (maybe Slack?), but in the interim, a good starting point is the docs here: https://docs.silverstripe.org/en/4/developer_guides/customising_the_admin_interface/reactjs_redux_and_graphql/ |
Relevant PR/discussion. #712 |
Apollo provides a refetch callback which forces a new request to be made, I don't remember the specifics at the moment, but I remember it was called Highly recommend checking out the Injector work and see if that can be utilised for your refresh button :) |
Hi @unclecheese, @flamerohr, Thanks for the info about NOTE: I'm making use of the Injector to add the new button to the gallery toolbar |
Sounds like this PR is no longer needed or that there's a better way of achieving the stated goal. Shall we close it? |
Closing as it seems to be domain-specific and we haven't had any follow-up from the author. |
Adds a new
handleRefreshPage
method to AssetAdmin JS which is then passed into theGallery
component and from there theGalleryToolbar
It works by passing updating the variables passed via GraphQL to include a random
cache_buster
. Just asking it to make the same request again doesn't work as the variables are the same so the response was being returned from an internal cache in theapollo-client
NOTE: Needing to add this so that a "sync" button (https://github.com/MadeHQ/silverstripe-cloudinary) that causes assets on the server to update from a third party store can then get the updates without having to navigate into and out of folders or close and then re-open the asset browser