From 5c4c1c7bf3e7d9c05241b25f06795add0d6c60db Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Tue, 12 Apr 2022 12:45:55 +0200 Subject: [PATCH] docs: add SSR discussion placeholder document. --- website/docs/topics/server-side-rendering.md | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 website/docs/topics/server-side-rendering.md diff --git a/website/docs/topics/server-side-rendering.md b/website/docs/topics/server-side-rendering.md new file mode 100644 index 0000000000..3c5e8b6857 --- /dev/null +++ b/website/docs/topics/server-side-rendering.md @@ -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.