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: filter tasks that are waiting for user input#19377

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 20 commits intomainfrombq/19324
Aug 21, 2025
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes#19324

Screenshot 2025-08-15 at 14 45 39

@BrunoQuaresmaBrunoQuaresma requested a review froma teamAugust 15, 2025 17:56
@BrunoQuaresmaBrunoQuaresma self-assigned thisAug 15, 2025
@BrunoQuaresmaBrunoQuaresma requested review fromaqandrew and removed request fora teamAugust 15, 2025 17:56
Comment on lines +5 to +6
// TODO: This is a temporary solution while the BE does not return the Task in a
// right shape with a custom name. This should be removed once the BE is fixed.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

LGTM, but deferring approval to FE domain experts.

BrunoQuaresma reacted with thumbs up emoji
value?:string;
};

functionuseUsersOptions({ query, value}:UseUsersOptionsOptions){
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't really need to be a hook imo. it should be a query function like we generally use, and it can takeuser as an argument.

Copy link
CollaboratorAuthor

@BrunoQuaresmaBrunoQuaresmaAug 19, 2025
edited
Loading

Choose a reason for hiding this comment

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

I know, but IMO, it encapsulates the intention quite well and improve the readability. It makes easier for me to know where and for what things are being used for. Eg. It is clear for me for what the useQuery and usesAuthenticated are being used for.

Unfortunately, you can't use hooks inside of regular functions, but I'm happy to change the code to use any existent convention.

Copy link
Member

Choose a reason for hiding this comment

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

the entirety of this hook except forconst { user } = useAuthenticated(); can be encapsulated in a query options function tho! and that better matches how we do it everywhere else.

Unfortunately, you can't use hooks inside of regular functions

and this is part of why I am so against custom hooks in 90% of use cases. they're viral function coloring, and should be avoided unless they are actually necessary to encapsulate stateful logic. I don't think that's the case here, as all of the logic is independent of the state.

Copy link
Member

Choose a reason for hiding this comment

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

I think the new React docs on custom hooks are very insightful. Even they don't think people should really be making custom hooks most of the time!

https://react.dev/learn/reusing-logic-with-custom-hooks#there-is-more-than-one-way-to-do-it

BrunoQuaresma reacted with heart emoji
Comment on lines 7 to 26
exportconstdata={
asynccreateTask(
prompt:string,
userId:string,
templateVersionId:string,
presetId:string|undefined,
):Promise<Task>{
constworkspace=awaitAPI.experimental.createTask(userId,{
name:`task-${generateWorkspaceName()}`,
template_version_id:templateVersionId,
template_version_preset_id:presetId,
prompt,
});

return{
workspace,
prompt,
};
},
};
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the need for thisdata wrapper. why not just export the function directly?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because of somespyOn limitations 😢. I'm not able to make it work when doing the following:

import*asdatafrom"./data"spyOn(data,"createTask")
Cannot spy on export "createTask". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations

But it should be temporary, since the create task API should handle that.

};

constsortSelectedFirst=(a:User)=>
value&&a.username===value ?-1 :0;
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't hand the case wherea.username === a.username

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Not sure if I got it 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I can't even blame you, writing sorting functions is really unintuitive. 😅

ifa.username === a.username anda.username === value you'll still return-1 when you should return 0. they'reboth the selected user, so you shouldn't be preferring one over the other. although I guess saying it out loud, that case probably won't ever come up except maybe in tests that don't generate unique usernames.

BrunoQuaresma reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Would it be ok if we let this as it is?

BrunoQuaresmaand others added2 commitsAugust 19, 2025 08:54
@BrunoQuaresmaBrunoQuaresma requested review fromaslilac and removed request foraqandrewAugust 19, 2025 12:17
Comment on lines 180 to 194
const[firstTask, ...otherTasks]=MockTasks;
spyOn(API,"getTemplates").mockResolvedValue([MockTemplate]);
spyOn(API.experimental,"getTasks").mockResolvedValue([
{
...firstTask,
workspace:{
...firstTask.workspace,
latest_app_status:{
...firstTask.workspace.latest_app_status,
state:"idle"asconst,
},
},
},
...otherTasks,
]);
Copy link
Member

Choose a reason for hiding this comment

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

this might be a nice opportunity to usestructuredClone to mask some noise:

Suggested change
const[firstTask, ...otherTasks]=MockTasks;
spyOn(API,"getTemplates").mockResolvedValue([MockTemplate]);
spyOn(API.experimental,"getTasks").mockResolvedValue([
{
...firstTask,
workspace:{
...firstTask.workspace,
latest_app_status:{
...firstTask.workspace.latest_app_status,
state:"idle"asconst,
},
},
},
...otherTasks,
]);
spyOn(API,"getTemplates").mockResolvedValue([MockTemplate]);
consttasks=structuredClone(MockTasks);
tasks[0].workspace.latest_app_status.state="idle";
spyOn(API.experimental,"getTasks").mockResolvedValue(tasks);

BrunoQuaresma reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

There is an issue with that,structuredClone keep the read only structure causing an TS error.

Cannot assign to 'state' because it is a read-only property.

Comment on lines +202 to +214
spyOn(API.experimental,"getTasks").mockResolvedValue([
{
...firstTask,
workspace:{
...firstTask.workspace,
latest_app_status:{
...firstTask.workspace.latest_app_status,
state:"idle"asconst,
},
},
// biome-ignore lint/suspicious/noExplicitAny: Testing malformed data edge cases
]asany;
},
...otherTasks,
]);
Copy link
Member

Choose a reason for hiding this comment

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

all the same applies here

);
}

constPillButton=({ className, active, ...props}:PillButtonProps)=>{
Copy link
Member

Choose a reason for hiding this comment

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

FC?

also, seems like a good candidate for a general component. might be worth moving to components/.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

seems like a good candidate for a general component.

Wdyt about waiting for more use cases using it?

};

constsortSelectedFirst=(a:User)=>
value&&a.username===value ?-1 :0;
Copy link
Member

Choose a reason for hiding this comment

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

I can't even blame you, writing sorting functions is really unintuitive. 😅

ifa.username === a.username anda.username === value you'll still return-1 when you should return 0. they'reboth the selected user, so you shouldn't be preferring one over the other. although I guess saying it out loud, that case probably won't ever come up except maybe in tests that don't generate unique usernames.

BrunoQuaresma reacted with thumbs up emoji
BrunoQuaresmaand others added4 commitsAugust 20, 2025 14:35
Co-authored-by: ケイラ <mckayla@hey.com>
Co-authored-by: ケイラ <mckayla@hey.com>
Co-authored-by: ケイラ <mckayla@hey.com>
@BrunoQuaresma
Copy link
CollaboratorAuthor

@aslilac hooks refactored and other requests added. ✅

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

LGTM pending FE approval.

@BrunoQuaresmaBrunoQuaresma merged commitd77c3d0 intomainAug 21, 2025
62 of 68 checks passed
@BrunoQuaresmaBrunoQuaresma deleted the bq/19324 branchAugust 21, 2025 18:06
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@aslilacaslilacaslilac left review comments

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Tasks: Filter tasks that are waiting for user input
3 participants
@BrunoQuaresma@aslilac@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp