treetracker-web-map-client icon indicating copy to clipboard operation
treetracker-web-map-client copied to clipboard

We need to find a way to manually refresh the next.js cache

Open dadiorchen opened this issue 2 years ago • 7 comments
trafficstars

I just encountered this problem:

  1. visit https://beta-map.treetracker.org/organizations/fcctrees it return 404, at this moment it is correct, because we don't have this org
  2. Then create organization by name: fcctrees
  3. visit the URL again, it is still 404
  4. Only way to refresh is to restart the next.js

We need to find a way to trigger the refresh and correct the 404 failure.


Some hints:

  • Please read our readme for more information/guide/tutorial.
  • For design guidelines checkout our Figma design.
  • Here is an engineering book in Greenstand.
  • To know more about our organization, visit our website.
  • If you want to join the slack community (some resources need the community member's permission), please leave your email address.
  • More issues in this project: https://github.com/orgs/Greenstand/projects/26

dadiorchen avatar Dec 09 '22 06:12 dadiorchen

@okdv I remember you did some research on this right?

dadiorchen avatar Dec 09 '22 06:12 dadiorchen

@dadiorchen ah yes, if i remember correctly we could create an endpoint that would manually refresh the cache for a specified page. there may also be a way to not cache the page at all if it routes to a 404 or something- but im not sure, i would need to look into that some more

been away working on a private contract so havent had much time for side stuff lately, but that contract should be done in about a week and i'll be back contributing some more :smile: let me look into this in the meantime and see what i can find

okdv avatar Dec 09 '22 19:12 okdv

@okdv will you be back soon? 😟

Like @okdv said, We could make an endpoint to manually refresh it on demand but it seems that the organization page get the values from props which is already set up to revalidate every 43.2 seconds or defaults to 30s if the env for cache revalidation is not provided.

Do you want me to reduce the time for the cache to revalidate. Also, how do I create and delete an organization? I want to reproduce the bug, but FCC is already established so I can't reproduce with the same example @dadiorchen

keyy123 avatar Dec 30 '22 17:12 keyy123

#1020 is the PR I had for this a while ago but forgot to fix the wrong HTTP error code

just updated that and submitted the PR for review

sorry holiday season has been crazier than expected :smile:

okdv avatar Dec 30 '22 20:12 okdv

Actually the revalidate time now is 24 hours, we need to be so so we get better performance, this is just the difficulty we need to solve, setting a cache in normal, but need a special way to kick out it and refresh the page.

dadiorchen avatar Jan 06 '23 02:01 dadiorchen

@dadiorchen makes sense for the cache timing. Does that endpoint satisfy the needs as far as cache revalidation goes? Or should there be some additional functionality to it?

okdv avatar Jan 08 '23 00:01 okdv

This is still a valid issue, here is @okdv 's work https://github.com/Greenstand/treetracker-web-map-client/pull/1020 we need someone who can continue and finish this for us.

dadiorchen avatar Jul 01 '23 02:07 dadiorchen