-
-
Notifications
You must be signed in to change notification settings - Fork 36
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4 Action statuses change to a single "status" property #37
Comments
I don't know about the actual background of this change but one issue with From a static analysis standpoint they could be all true at the same time whereas |
Yes, this is exactly why I changed the API. Also, I think it's way cleaner to have just one
You can define an util function like this: export function isExecuting(status: HookActionStatus): status is "executing" {
return status === "executing";
} Then import and use it in your Client Components. It's almost the same as having pre-v4 |
Hope the code snippet above solved your problem. If you have any additional questions about this implementation, feel free to leave a comment here, and, if needed, I'll reopen the issue. Thank you! |
Sometimes it's useful and more elegant to check the action status using a function instead of string equality. This commit exports util functions to do that, while ensuring the same discriminated behavior that the single `status` property provides to the user, thanks to TypeScript's type predicates feature. re #61, re #37
Hey, first of all, huge thanks for this pckg! Good job!
Problem
Quick question/suggestion. What's the background of this change?
Single
status
string property is a step back in terms of DX imho. JSX with string conditions (likestatus === 'executing'
) looks messier and more code to write. Noticed, I started manually creatingisExecuting
consts (and some for other statuses) all over the project.Old api vs New api
Extra
Tanstack Query Api could be great inspiration (for naming things as well) - I assume community got really used to it in past years.
The text was updated successfully, but these errors were encountered: