2 months ago
I have a service availability ticker I show on the website controlled by an env variable, locally I confirmed it works, so now I pushed code to change the content of the ticker, and then once that was done I switched the env to true meaning show the banner on the website, but it isn't showing, after a cached build. Which I'm assuming is causing this issue.
23 Replies
Attachments
This is what prod looks like
Attachments
when it's meant to show
Attachments
Pushed something small so a cache build doesnt occur and now users can see the ticker
2 months ago
Yeah if the environment variables are read in at build time and not referenced at runtime a cached build would cause this. What stack are you on? would be interested to see why that's happening.
If you're doing server side rendered pages that reference environment variables on each request build cache shouldn't matter
2 months ago
If you can share the code (or a minimum repro of it) that generates that banner would be happy to point ya in the right direction
Here's the file for the banner.
https://github.com/JBChangelogs/JailbreakChangelogs/blob/main/src/components/Layout/NewsTicker.tsx
I control it with a flag of NEWS_TICKER to determine whether to show it or not
2 months ago
Yeah these only get changed on build cause they're injected at build in the feature flags file
2 months ago
So flipping the flag triggers a rebuild and that's what injects the variable and sets the flag. If the build is skipped the change doesn't take effect
2 months ago
Yeah if you want to rely on a rebuild for feature flags you would have to.
There are other ways to do flags though if you want them to be more instant.
2 months ago
I.e. you could put your flags into your API
2 months ago
Just means an extra API request when your client hydrates