Conversation
Migration Safety CheckFound 1 potential issue: 20260417_202409_add_dev_mode.ts Warning (line 6): ALTER keyword detected - review for data loss sql`ALTER TABLE \`nac_widgets_config\` ADD \`dev_mode\` integer DEFAULT false NOT NULL;`,Review these patterns and add backup/restore logic if needed. See |
|
Preview deployment: https://nac-dev.preview.avy-fx.org |
|
@busbyk |
|
@busbyk Ready for review |
| jest.mock('../../src/services/nac/nac', () => ({ | ||
| getAvalancheCenterPlatforms: jest.fn(async (centerSlug: string) => { | ||
| const centerSlugToUse = centerSlug === 'dvac' ? 'nwac' : centerSlug | ||
|
|
||
| return mockCenters[centerSlugToUse] ?? allFalsePlatforms | ||
| }), | ||
| })) |
There was a problem hiding this comment.
Replacing the function we're testing here with a mocked function that's only used in this test doesn't actually test the getAvalancheCenterPlatforms function.
Ideally, we would intercept the API requests and return mocked data using MSW or something similar so that we would be testing the actual implementation of getAvalancheCenterPlatforms.
If you don't want to set up MSW, I suggest removing this test file completely.
There was a problem hiding this comment.
Good callout - set up MSW you linked and implemented this in 251372b
There was a problem hiding this comment.
Did you forget to push? I'm not seeing this update in that commit or in this PR?
There was a problem hiding this comment.
This was so long ago I have no idea what I meant but this was not done in that commit. I remember coding this but don't know what happened. Done in 9ff7a91
|
@busbyk this is ready for re-review |
busbyk
left a comment
There was a problem hiding this comment.
Re-reviewing this I had the thought: I wonder if we could use a provider and hook to provide the NAC Widgets Config to the NACWidget client component instead of all of this prop passing. This PR had to touch so many files just to add an option to that component.
…s read config and avoid prop passing
|
@busbyk Made this update. Good suggestion |
Description
Add a
devModesetting to the NAC Widgets Config admin panel and pass it through to all NAC widget components.Previously,
devModewas always hardcoded tofalse. This makes it impossible for staging/preview deployments to point widgets at the NAC staging base URL — needed for AvyApp development and testing custom data entered in staging. In production,devModeis always forced tofalseregardless of the admin panel setting.Related Issues
Fixes #717
Key Changes
devModecheckbox to NAC Widgets Config globaldevModesetting in non-production environments, forcefalsein productiondevModethrough to all NAC widget components (was hardcodedfalse)getNACWidgetsConfigandgetAvalancheCenterPlatformsusing MSW to intercept HTTP requestsdevModecolumnHow to test
2. with admin panel devMode off→ widgets use production URL (
devMode: false)3. with admin panel devMode on → widgets use staging URL (
devMode: true)devMode: false) regardless of admin setting/api/[center]/nac-configreturns the correctdevModevaluepnpm test— all tests passMigration Explanation
Adds a
devModeboolean column (defaultfalse) to the NAC widgets config table. Non-destructive — existing rows get the default value.