-
Notifications
You must be signed in to change notification settings - Fork 478
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
Remove the Tooltip Message After Cover Image Edit #8480
Comments
@nihal467 Can you assign this issue to me? Thx. |
Let's clear the browser cache using vary header method mentioned in this https://www.fastly.com/blog/clearing-cache-browser. We can perform the cache invalidation once the cover image upload has been completed. This would ensure the latest image is rendered. cc: @sainak |
@rithviknishad Hmm, since useQuery doesn't support a header parameter, I'd either need to replace it with a fetch outside or modify RequestOptions interface and request function to support header property (preferring the former since it touches less code). Does that sound right, or is there an alternative option? |
you'll have to use fetch directly to achieve this since the image url is not a defined api route right? useQuery/request requires an API route to be defined, and the image url is not an API route. |
The additional headers on request options however is useful. Can be done in a separate issue/PR. |
@rithviknishad Oh, I meant moving out the facilityData useQuery to a fetch req (since cover image url is part of that object). Hmm, as for fetching the image url directly, that would require modifications on the backend, right? |
No, you just need to simply send a fetch request to the signed URL of the image with that vary header, so that browser would invalidate it's cache. Therefore leading to the image component to render the new image as the new image is fetched instead of the old cached one. Nothing to do with calling any APIs. |
(1) Couldn't use the fetch + vary method as the HeadersInit type doesn't support it
(2) Tried fetch + cache:reload instead. Checking the network tab, it does pull the new version of the image, however I had to append timestamp to have it reflect on page (I tried changing image src directly using getElementById, but that didn't reflect on screen). fetchImage is called on save of the Edit Cover Image Modal/Popup. It doesn't seem to update the cache though, since the change doesn't persist across page reload. https://stackoverflow.com/questions/1077041/refresh-image-with-a-new-one-at-the-same-url/22429796#22429796 mentions few other solutions, including just using timestamp on img src directly, however that would mean storing multiple copies of the same image on cache. |
Did you try passing a |
Never mind, I cleared my browser cache/restarted the dev server and it's working (persists across page reload). Only other issue is the change not reflecting on FacilityCard (if the user navigates thru back button or breadcrumb menu instead of reloading). |
Hey, could you push the current changes? |
Done 👍 |
@rithviknishad we still need to remove
care_fe/src/Components/Facility/FacilityHome.tsx Lines 132 to 138 in f62ff79
|
Describe the bug
With ohcnetwork/care#2472 we no longer need to show the tooltip as it'll always show the new image.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Screenshots
The text was updated successfully, but these errors were encountered: