Skip to content
Merged
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
13 changes: 10 additions & 3 deletions packages/fxa-settings/src/models/contexts/NimbusContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ export function NimbusProvider({ children }: NimbusProviderProps) {
return;
}

if (!config?.nimbus.enabled || !uniqueUserId) {
const nimbusUserId = legacyLocalStorageAccount?.uid || uniqueUserId;
Copy link
Contributor

@LZoog LZoog Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this isn't necessarily a legacy local storage account, could call it something else here?

Though, potentially an actual issue: this won't update if a user hits Accounts and then signs in or signs up, React won't be reactive to the local storage update to be able to rerun this useEffect based on that dep. This sort of relates to that other follow up issue I filed... I assume we want to address this, and not use the Nimbus uniqueUserId when that happens? LMK if so and if you'll address that elsewhere and I'll r+ this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LZoog Yea, this one will be addressed in an upcoming PR. It turned out to be pretty hairy and wanted to keep the PRs separate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, will r+ this then 👍


if (!config?.nimbus.enabled || !nimbusUserId) {
setExperiments(null);
setLoading(false);
setError(undefined);
Expand All @@ -111,7 +113,7 @@ export function NimbusProvider({ children }: NimbusProviderProps) {
: searchParams(window.location.search)[NIMBUS_PREVIEW_PARAM] === 'true';

const nimbusResult = await initializeNimbus(
uniqueUserId,
nimbusUserId,
nimbusPreview,
{
language,
Expand Down Expand Up @@ -154,7 +156,12 @@ export function NimbusProvider({ children }: NimbusProviderProps) {
return () => {
mounted = false;
};
}, [config?.nimbus.enabled, config?.nimbus.preview, uniqueUserId, currentLocale]);
}, [
config?.nimbus.enabled,
config?.nimbus.preview,
uniqueUserId,
currentLocale
]);

const value: NimbusContextValue = useMemo(() => ({
experiments,
Expand Down