Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8f4dc6

Browse files
authored
feat: check for classic flow on the create workspace page (#17852)
the local storage key is only set when a user presses the opt-in oropt-out buttonsOverall, this feels less annoying for users to have to opt-in/opt-out onevery visit to the create workspace page. Maybe less of a concern forend users but more of a concern while dogfooding.Pros:- User gets the admin setting value for the template as long as theydidn't opt-in or opt-out- User can choose to opt-in/out-out at will and their preference issaved
1 parent8914f7a commitf8f4dc6

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

‎site/src/pages/CreateWorkspacePage/CreateWorkspaceExperimentRouter.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,26 @@ const CreateWorkspaceExperimentRouter: FC = () => {
3030
templateQuery.data.id,
3131
"optOut",
3232
],
33-
queryFn:()=>({
34-
templateId:templateQuery.data.id,
35-
optedOut:
36-
localStorage.getItem(optOutKey(templateQuery.data.id))==="true",
37-
}),
33+
queryFn:()=>{
34+
consttemplateId=templateQuery.data.id;
35+
constlocalStorageKey=optOutKey(templateId);
36+
conststoredOptOutString=localStorage.getItem(localStorageKey);
37+
38+
letoptOutResult:boolean;
39+
40+
if(storedOptOutString!==null){
41+
optOutResult=storedOptOutString==="true";
42+
}else{
43+
optOutResult=Boolean(
44+
templateQuery.data.use_classic_parameter_flow,
45+
);
46+
}
47+
48+
return{
49+
templateId:templateId,
50+
optedOut:optOutResult,
51+
};
52+
},
3853
}
3954
:{enabled:false},
4055
);
@@ -49,11 +64,15 @@ const CreateWorkspaceExperimentRouter: FC = () => {
4964

5065
consttoggleOptedOut=()=>{
5166
constkey=optOutKey(optOutQuery.data.templateId);
52-
constcurrent=localStorage.getItem(key)==="true";
67+
conststoredValue=localStorage.getItem(key);
68+
69+
constcurrent=storedValue
70+
?storedValue==="true"
71+
:Boolean(templateQuery.data?.use_classic_parameter_flow);
72+
5373
localStorage.setItem(key,(!current).toString());
5474
optOutQuery.refetch();
5575
};
56-
5776
return(
5877
<ExperimentalFormContext.Providervalue={{ toggleOptedOut}}>
5978
{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)

[8]ページ先頭

©2009-2025 Movatter.jp