As a web developer I need to ensure that every point in a request lifecycle uses the same version of an Optimizely datafile to ensure a page is rendered correctly. This includes:
edge function logic
serverside render
clientside hydration
If there is a mismatch in Optimizely datafile versions between edge function logic and serverside render, then the incorrect decision could be used to generate a page that is saved into the CDN cache. If there is a mismatch in Optimizely datafile versions between the serverside render and the clientside hydration, then hydration mismatch bugs will occur.
Optimizely's current recommendation seems to be for customers to serialise the datafile during the serverside render into the HTML of the page so the client side can use the same version. But this results in page bloat.
It would be better if the edge function could tell the serverside render which revision of a datafile it used, and then for server to fetch this specific revision of the datafile from the Optimizely CDN. And similarly for the server to tell the client which revision to fetch.
For example, given a project ID of 12345, the latest version of the datafile is served at https://cdn.optimizely.com/json/12345.json
Optimizely could also serve previous versions of this datafile from its CDN, for example https://cdn.optimizely.com/json/12345.json?revision=6, https://cdn.optimizely.com/json/12345.json?revision=5, https://cdn.optimizely.com/json/12345.json?revision=4,