This repository shows how to manually implement feature flags on Vercel for pages that are ISR'd using SvelteKit.
Flow:
middleware.ts
. A flag cookie is looked up to see what value it is. For first time visitors the value is computed randomly./
goes either to /home-a
or /home-b
)/home-a
or /home-b
middleware.ts
, so ISR/SvelteKit itself never sees it, which is important), so revisiting user gets the same flag valuereroute
hook in hooks.ts
is invoked, also reading from that cookie to determine where to go to when navigating to /