Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ npx firebase hosting:channel:deploy {channel_name}

Firebase remote configs help us toggle new features on and off. Due to the nature of static pages, there are some nuances. For static pages, the remote configs are called and set at build time and will be the same for the remainder of the static page's cache.

When remote configs change (they rarily do), it is recommended to redeploy the app as that will trigger a new cache for all pages, that will include the updated remote configs
When remote configs change (they rarely do), manually purge the `remote-config` cache tag in the Vercel dashboard (Storage -> Data Cache) after publishing the change. Redeploying the app is not sufficient on its own — Vercel's Data Cache persists across deployments, so a fresh deployment can still serve the stale remote config value.

Note: purging the `remote-config` tag also invalidates every static and ISR page site-wide, not just feed pages. The remote config is fetched in the root layout, which every page shares, so purging that one tag marks every statically-generated page for regeneration on its next visit.

What this also means is that client components will be able to access the firebase remote configs using the Context but server components will have to fetch them each time. This isn't a big deal as the firebase remote configs are cached (for 1 hour on the server)

Expand Down
15 changes: 12 additions & 3 deletions cypress/e2e/accountGeneral.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ describe('Account General Page', () => {
cy.contains('label', 'Name')
.invoke('attr', 'for')
.then((id) => {
cy.get(`#${id}`).clear().type('Updated Name');
cy.get(`#${id}`).clear();
cy.get(`#${id}`).should('have.value', '');
cy.get(`#${id}`).type('Updated Name');
cy.get(`#${id}`).should('have.value', 'Updated Name');
});

cy.contains('label', 'Organization')
.invoke('attr', 'for')
.then((id) => {
cy.get(`#${id}`).clear().type('Updated Organization');
cy.get(`#${id}`).clear();
cy.get(`#${id}`).should('have.value', '');
cy.get(`#${id}`).type('Updated Organization');
cy.get(`#${id}`).should('have.value', 'Updated Organization');
});

cy.contains('button', 'Save').click();
Expand Down Expand Up @@ -106,7 +112,10 @@ describe('Account General Page', () => {
cy.contains('label', 'Name')
.invoke('attr', 'for')
.then((id) => {
cy.get(`#${id}`).clear().type('Will Not Save');
cy.get(`#${id}`).clear();
cy.get(`#${id}`).should('have.value', '');
cy.get(`#${id}`).type('Will Not Save');
cy.get(`#${id}`).should('have.value', 'Will Not Save');
});

cy.contains('button', 'Save').click();
Expand Down
12 changes: 9 additions & 3 deletions cypress/e2e/userFeatureFlags.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TEST_FEED_URL = '/feeds/gtfs/test-516';

const ALL_DEFAULTS = {
isNotificationsEnabled: false,
isSealOfReliabilityFilterEnabled: false,
isSealFilterEnabled: false,
};

interface MockFeature {
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('User Feature Flags', () => {
it('falls back to defaults for flags the API omits', () => {
interceptUserProfile([
{
id: 'isSealOfReliabilityFilterEnabled',
id: 'isSealFilterEnabled',
value_type: 'boolean',
value: true,
},
Expand All @@ -151,7 +151,7 @@ describe('User Feature Flags', () => {

expectResolvedFlags({
isNotificationsEnabled: false,
isSealOfReliabilityFilterEnabled: true,
isSealFilterEnabled: true,
});
});

Expand All @@ -173,6 +173,12 @@ describe('User Feature Flags', () => {
let callsOnLoad = 0;

cy.visit('/');
// /account is gated by ProtectedPageWrapper on a 'registered' Redux
// profile status, which the Firebase-only sign-in from the outer
// beforeEach does not set (see loginViaSaga's docstring). Without this,
// the accountHeader click below races ProtectedPageWrapper's redirect
// to /sign-in.
loginViaSaga();
expectResolvedFlags({ ...ALL_DEFAULTS, isNotificationsEnabled: true });
cy.then(() => {
callsOnLoad = profile.calls();
Expand Down
4 changes: 2 additions & 2 deletions docs/user-feature-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ Edit `src/app/interface/UserFeatureFlags.ts` — one change updates everything:
```ts
export interface UserFeatureFlags {
isNotificationsEnabled: boolean;
isSealOfReliabilityFilterEnabled: boolean;
isSealFilterEnabled: boolean;
myNewFlag: boolean; // add here
}

export const defaultUserFeatureFlags: UserFeatureFlags = {
isNotificationsEnabled: false,
isSealOfReliabilityFilterEnabled: false,
isSealFilterEnabled: false,
myNewFlag: false, // and here
};
```
Expand Down
Loading
Loading