1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

docs: add SSR discussion placeholder document.

This commit is contained in:
Thomas Heartman 2022-04-12 12:45:55 +02:00
parent f12f8b8548
commit 5c4c1c7bf3

View File

@ -0,0 +1,36 @@
---
title: Unleash and server-side rendering
---
## The practical stuff
### Prerequisites
Provide InMemoryStorageProvider
Provide a fetch implementation.
See [this GitHub issue regarding usage with Next.js](https://github.com/Unleash/proxy-client-react/issues/40).
### How to do SSR
disable metrics and disable refresh to avoid keeping thread alive. this can cause a memory leak.
Zoro did this and created a new client on every request.
#### Anything for Next.js specifically?
Can the toggles be made available via a global cache? This could save you from having to make an http request to fetch toggles on every incoming request.
### How to do SSG
Should work the same as SSR, just done at build time.
## The discussion
### When is SSR appropriate?
When the same feature flags apply to a lot of users
### When shouldn't you use SSR?
If everything is very client-specific, you may be better off resolving feature flags on the client. Improves caching, etc.