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(site): fix disappearing preset selector when switching template#20514

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
DanielleMaywood merged 4 commits intomainfromdanielle/fix/preset-selector
Oct 29, 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
120 changes: 120 additions & 0 deletionssite/src/modules/tasks/TaskPrompt/TaskPrompt.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -480,3 +480,123 @@ export const CheckExternalAuthOnChangingVersions: Story = {
});
},
};

export const CheckPresetsWhenChangingTemplate: Story = {
args: {
templates: [
{
...MockTemplate,
id: "claude-code",
name: "claude-code",
display_name: "Claude Code",
active_version_id: "claude-code-version",
},
{
...MockTemplate,
id: "codex",
name: "codex",
display_name: "Codex",
active_version_id: "codex-version",
},
],
},
beforeEach: () => {
spyOn(API, "getTemplateVersionPresets").mockImplementation((versionId) => {
if (versionId === "claude-code-version") {
return Promise.resolve([
{
...MockPresets[0],
ID: "claude-code-preset-1",
Name: "Claude Code Dev",
},
]);
}
if (versionId === "codex-version") {
return Promise.resolve([
{
...MockPresets[0],
ID: "codex-preset-1",
Name: "Codex Dev",
},
]);
}
return Promise.resolve([]);
});
spyOn(API, "getTemplateVersions").mockImplementation((templateId) => {
if (templateId === "claude-code") {
return Promise.resolve([
{
...MockTemplateVersion,
id: "claude-code-version",
name: "claude-code-version",
},
]);
}
if (templateId === "codex") {
return Promise.resolve([
{
...MockTemplateVersion,
id: "codex-version",
name: "codex-version",
},
]);
}
return Promise.resolve([]);
});
},
play: async ({ canvasElement, step }) => {
const canvas = within(canvasElement);
const body = within(canvasElement.ownerDocument.body);

await step("Presets are initially present", async () => {
const presetSelect = await canvas.findByLabelText(/preset/i);
await userEvent.click(presetSelect);

const options = await body.findAllByRole("option");
expect(options).toHaveLength(1);
expect(options[0]).toContainHTML("Claude Code Dev");

await userEvent.click(options[0]);
});

await step("Switch template", async () => {
const templateSelect = await canvas.findByLabelText(/select template/i);
await userEvent.click(templateSelect);

const codexTemplateOption = await body.findByRole("option", {
name: /codex/i,
});
await userEvent.click(codexTemplateOption);
});

await step("Presets are present in new template", async () => {
const presetSelect = await canvas.findByLabelText(/preset/i);
await userEvent.click(presetSelect);

const options = await body.findAllByRole("option");
expect(options).toHaveLength(1);
expect(options[0]).toContainHTML("Codex Dev");

await userEvent.click(options[0]);
});

await step("Switch template back", async () => {
const templateSelect = await canvas.findByLabelText(/select template/i);
await userEvent.click(templateSelect);

const codexTemplateOption = await body.findByRole("option", {
name: /claude code/i,
});
await userEvent.click(codexTemplateOption);
});

await step("Presets are present in original template", async () => {
const presetSelect = await canvas.findByLabelText(/preset/i);
await userEvent.click(presetSelect);

const options = await body.findAllByRole("option");
expect(options).toHaveLength(1);
expect(options[0]).toContainHTML("Claude Code Dev");
});
},
};
7 changes: 6 additions & 1 deletionsite/src/modules/tasks/TaskPrompt/TaskPrompt.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -270,7 +270,12 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
</label>
<Select
name="templateID"
onValueChange={(value) => setSelectedTemplateId(value)}
onValueChange={(value) => {
setSelectedTemplateId(value);
if (value !== selectedTemplateId) {
setSelectedPresetId(undefined);
}
}}
defaultValue={templates[0].id}
required
>
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp