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

fix: show error message for incompatible parameters#18365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jaaydenh merged 1 commit intomainfromjaaydenh/incompatible-parameters-warning
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -596,11 +596,18 @@ export const CreateWorkspacePageViewExperimental: FC<
const currentParameterValueIndex =
form.values.rich_parameter_values?.findIndex(
(p) => p.name === parameter.name,
) ?? -1;
Copy link
Member

Choose a reason for hiding this comment

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

This feels like it could be a bad default 🤔

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

yup, I removed this to check undefined instead

);
const parameterFieldIndex =
currentParameterValueIndex !==-1
currentParameterValueIndex !==undefined
? currentParameterValueIndex
: index;
// Get the form value by parameter name to ensure correct value mapping
const formValue =
currentParameterValueIndex !== undefined
? form.values?.rich_parameter_values?.[
currentParameterValueIndex
]?.value || ""
: "";
const parameterField = `rich_parameter_values.${parameterFieldIndex}`;
const isPresetParameter = presetParameterNames.includes(
parameter.name,
Expand All@@ -622,14 +629,6 @@ export const CreateWorkspacePageViewExperimental: FC<
return null;
}

// Get the form value by parameter name to ensure correct value mapping
const formValue =
currentParameterValueIndex !== -1
? form.values?.rich_parameter_values?.[
currentParameterValueIndex
]?.value || ""
: "";

return (
<DynamicParameter
key={parameter.name}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -123,6 +123,13 @@ export const WorkspaceParametersPageViewExperimental: FC<
setFieldValue: form.setFieldValue,
});

const hasIncompatibleParameters = parameters.some((parameter) => {
if (!parameter.mutable && parameter.diagnostics.length > 0) {
return true;
}
return false;
});

return (
<>
{disabled && (
Expand All@@ -132,6 +139,38 @@ export const WorkspaceParametersPageViewExperimental: FC<
</Alert>
)}

{hasIncompatibleParameters && (
<Alert severity="error">
<p className="text-lg leading-tight font-bold m-0">
Workspace update blocked
</p>
<p className="mb-0">
The new template version includes parameter changes that are
incompatible with this workspace's existing parameter values. This
may be caused by:
</p>
<ul className="mb-0 pl-4 space-y-1">
<li>
New <strong>required</strong> parameters that cannot be provided
after workspace creation
</li>
<li>
Changes to <strong>valid options or validations</strong> for
existing parameters
</li>
<li>Logic changes that conflict with previously selected values</li>
</ul>
<p className="mb-0">
Please contact the <strong>template administrator</strong> to review
the changes and ensure compatibility for existing workspaces.
</p>
<p className="mb-0">
Consider supplying defaults for new parameters or validating
conditional logic against prior workspace states.
</p>
</Alert>
)}

{diagnostics && diagnostics.length > 0 && (
<div className="flex flex-col gap-4 mb-8">
{diagnostics.map((diagnostic, index) => (
Expand DownExpand Up@@ -182,7 +221,23 @@ export const WorkspaceParametersPageViewExperimental: FC<
</p>
</hgroup>
{standardParameters.map((parameter, index) => {
const parameterField = `rich_parameter_values.${index}`;
const currentParameterValueIndex =
form.values.rich_parameter_values?.findIndex(
(p) => p.name === parameter.name,
);
const parameterFieldIndex =
currentParameterValueIndex !== undefined
? currentParameterValueIndex
: index;
// Get the form value by parameter name to ensure correct value mapping
const formValue =
currentParameterValueIndex !== undefined
? form.values?.rich_parameter_values?.[
currentParameterValueIndex
]?.value || ""
: "";

const parameterField = `rich_parameter_values.${parameterFieldIndex}`;
const isDisabled =
disabled ||
parameter.styling?.disabled ||
Expand All@@ -198,9 +253,7 @@ export const WorkspaceParametersPageViewExperimental: FC<
}
autofill={false}
disabled={isDisabled}
value={
form.values?.rich_parameter_values?.[index]?.value || ""
}
value={formValue}
/>
);
})}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp