Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b428bc

Browse files
committed
fix: check if localstorage value is null
1 parent 411925a commit 4b428bc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspaceExperimentRouter.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,15 @@ const CreateWorkspaceExperimentRouter: FC = () => {
6464

6565
const toggleOptedOut = () => {
6666
const key = optOutKey(optOutQuery.data.templateId);
67-
const current = localStorage.getItem(key) === "true";
67+
const storedValue = localStorage.getItem(key);
68+
69+
const current = storedValue
70+
? storedValue === "true"
71+
: Boolean(templateQuery.data?.use_classic_parameter_flow);
72+
6873
localStorage.setItem(key, (!current).toString());
6974
optOutQuery.refetch();
7075
};
71-
7276
return (
7377
<ExperimentalFormContext.Provider value={{ toggleOptedOut }}>
7478
{optOutQuery.data.optedOut ? (

site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
242242
<span>
243243
Show the original workspace creation form without dynamic
244244
parameters or live updates. Recommended if your provisioners
245-
aren't updated or the new form causes issues.
245+
aren't updated or the new form causes issues.{" "}
246246
<strong>
247247
Users can always manually switch experiences in the
248248
workspace creation form.

0 commit comments

Comments
 (0)