plasmicapp / plasmic

Visual builder for React. Build apps, websites, and content. Integrate with your codebase.
https://www.plasmic.app
MIT License
4.69k stars 377 forks source link

Disabling fetch cache on particular page #78

Closed neko1101 closed 1 year ago

neko1101 commented 1 year ago

I have a summary page that depends on previous rest api backend update.

How do we refresh the summary page rest api fetch on the plasmic studio?

Currently, im using a workaround by adding nonce or uuid to the page path to avoid caching.

cached page: /path/to/summary/<summary-id>

This will skip cache every time: /path/to/summary/<summary-id>/<random-useless-uuid>

Is there any elegant way of disabling page from being cached?

yang commented 1 year ago

Are you using nextjs? You can use getServerSideProps instead of static.

Or if you're using plasmic hosting, enable authentication in your app to disable static caching.

Let me know if that helps.

neko1101 commented 1 year ago

@yang thanks!

I enabled the authentication in my app, how do i disable the static caching?

P/s: the page role is set to anonymous at the moment.

yang commented 1 year ago

Once you've enabled authentication, then that should be it, the next time you hit Publish, it should no longer do any static caching on Plasmic hosting.

On Mon, Apr 3, 2023, 5:17 AM Neko @.***> wrote:

@yang https://github.com/yang thanks!

I enabled the authentication in my app, how do i disable the static caching?

P/s: the page role is set to anonymous at the moment.

— Reply to this email directly, view it on GitHub https://github.com/plasmicapp/plasmic/issues/78#issuecomment-1494216947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWIMP4E2I76MHDXQMETW7K5TXANCNFSM6AAAAAAWQNHH6U . You are receiving this because you were mentioned.Message ID: @.***>

neko1101 commented 1 year ago

@yang great!

What if i host on vercel?

Does the static caching will be disabled or i need to change it to getServerSideProps() ?

Thanks~

yang commented 1 year ago

You need to change it, since this is in your control

On Tue, Apr 4, 2023, 2:26 AM Neko @.***> wrote:

@yang https://github.com/yang great!

What if i host on vercel?

Does the static caching will be disabled or i need to change it to getServerSideProps() ?

Thanks~

— Reply to this email directly, view it on GitHub https://github.com/plasmicapp/plasmic/issues/78#issuecomment-1495641301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWJETURR74TKMZI4KW3W7PSNBANCNFSM6AAAAAAWQNHH6U . You are receiving this because you were mentioned.Message ID: @.***>