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
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,26 @@ const CreateWorkspaceExperimentRouter: FC = () => {
templateQuery.data.id,
"optOut",
],
queryFn: () => ({
templateId: templateQuery.data.id,
optedOut:
localStorage.getItem(optOutKey(templateQuery.data.id)) === "true",
}),
queryFn: () => {
const templateId = templateQuery.data.id;
const localStorageKey = optOutKey(templateId);
const storedOptOutString = localStorage.getItem(localStorageKey);

let optOutResult: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

could we use a ternary here?


if (storedOptOutString !== null) {
optOutResult = storedOptOutString === "true";
} else {
optOutResult = Boolean(
templateQuery.data.use_classic_parameter_flow,
);
}

return {
templateId: templateId,
optedOut: optOutResult,
};
},
}
: { enabled: false },
);
Expand All @@ -49,11 +64,15 @@ const CreateWorkspaceExperimentRouter: FC = () => {

const toggleOptedOut = () => {
const key = optOutKey(optOutQuery.data.templateId);
const current = localStorage.getItem(key) === "true";
const storedValue = localStorage.getItem(key);

const current = storedValue
? storedValue === "true"
: Boolean(templateQuery.data?.use_classic_parameter_flow);

localStorage.setItem(key, (!current).toString());
optOutQuery.refetch();
};

return (
<ExperimentalFormContext.Provider value={{ toggleOptedOut }}>
{optOutQuery.data.optedOut ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
<span>
Show the original workspace creation form without dynamic
parameters or live updates. Recommended if your provisioners
aren't updated or the new form causes issues.
aren't updated or the new form causes issues.{" "}
<strong>
Users can always manually switch experiences in the
workspace creation form.
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy