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

feat: select template version for tasks#20146

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
BrunoQuaresma merged 3 commits intomainfrombq/template-version
Oct 6, 2025

Conversation

BrunoQuaresma
Copy link
Collaborator

Allows users withupdateTemplates permission to select a specific template version when creating a task.

One of the biggest changes was movingTaskPrompt intomodules/task and adding a Storybook entry for it. I also moved some stories fromTasksPage to simplify its story.

Screenshot 2025-10-02 at 12 09 06

Closes#19986

@BrunoQuaresmaBrunoQuaresma requested a review froma teamOctober 2, 2025 15:16
@BrunoQuaresmaBrunoQuaresma self-assigned thisOct 2, 2025
@BrunoQuaresmaBrunoQuaresma requested review fromaqandrew and removed request fora teamOctober 2, 2025 15:16
Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

I see a lot of types coming from the backend here with PascalCase. this isn't the first time, and I don't want it to become a habit. I think we need to nip these here and now.

Emyrk reacted with thumbs up emoji
Comment on lines +185 to +189
useEffect(()=>{
if(presetPrompt){
setPrompt(presetPrompt);
}
},[presetPrompt]);
Copy link
Member

Choose a reason for hiding this comment

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

this is derived state. no need for auseEffect here.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

I’m not sure I follow. Theprompt value is the controlled state for the textarea, and we want to sync it with the preset prompt (when one exists) as needed. 🤔

Copy link
Member

@aslilacaslilacOct 3, 2025
edited
Loading

Choose a reason for hiding this comment

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

value={prompt ?? presetPrompt} or something like that

Effects are for synchronizing with the outside world. this value is already in React, so there's no more need for an effect.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

I’m still not quite following. When there’s a preset prompt, I want theprompt value to be set to it; otherwise I’d have to usepresetPrompt || prompt and re-check it again on submit, which doesn’t feel cleaner. Also, when new presets load, I need to sync other state (e.g., set a new default for the selected preset). 🤔

If you’re available, I’d appreciate pairing on this so I can learn the approach.

Comment on lines 174 to +177
useEffect(()=>{
setSelectedPresetId(defaultPreset?.ID);
},[defaultPreset?.ID]);

// Extract AI prompt from selected preset
constdefaultPreset=presets?.find((p)=>p.Default);
setSelectedPresetId(defaultPreset?.ID??presets?.[0]?.ID);
},[presets]);
Copy link
Member

Choose a reason for hiding this comment

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

this is also derived state.selectedPresetId can already be undefined, just sayconst presetId = selectedPresetId ?? defaultPresetId somewhere.

and as a related semantics nit: there's nothing "selected" about a default. defaults are the absence of a more meaningful selected value.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

I’m also not sure I follow here. We haveselectedPresetId, which is the state used by the presets select. When the presets change—because the user selected a different template or version—it should be reset. I’m not sure how we could achieve that with derived state only. Could you show me an example?

@BrunoQuaresma
Copy link
CollaboratorAuthor

@asilac I left a few comments to make sure I fully understand how your observations could be turned into derived state.

Regarding the BE attributes: I’ve discussed this with the team before, and it would introduce a breaking change (request body and potentially the response). If we want to move forward, I suggest we first start a broader discussion in the dev channel, and then open a separate PR dedicated to those API changes. What do you think?

@BrunoQuaresmaBrunoQuaresma merged commit840afb2 intomainOct 6, 2025
31 checks passed
@BrunoQuaresmaBrunoQuaresma deleted the bq/template-version branchOctober 6, 2025 13:23
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 6, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@aslilacaslilacaslilac approved these changes

@aqandrewaqandrewAwaiting requested review from aqandrewaqandrew was automatically assigned from coder/ts

@ParkreinerParkreinerAwaiting requested review from ParkreinerParkreiner is a code owner

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Make it possible to create Tasks from a specific template version.
2 participants
@BrunoQuaresma@aslilac

[8]ページ先頭

©2009-2025 Movatter.jp