Avoid spawn_local in favour of async functions #61
Labels
No labels
bug
documentation
duplicate
enhancement
Feature Request
good first issue
help wanted
improvement
in progress
invalid
nag
Priority: High
Priority: Low
Priority: Medium
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Strichliste/strichliste#61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A lot of early code still contains spawn_local. replace this in favour of async functions
But you need
spawn_localin order to call async functions. Or do you mean wrap them in stuff likeResources?Either way, I don't see the issue with
spawn_localon a button press for example.There are Actions for this in leptos - at least as far as I understand Actions
Yes, but sometimes they aren't as flexible as just calling the server function directly.
For example:
We need to set
type=hiddenon the input for the user id, since the server function needs it, but the user obviously shouldn't supply it's own user id in the Form.Another example would be change_money_button
We could change the function call into a component and convert
change_moneyinto a ActionForm. But then we need to move the client side logic of creating a Transaction into a new server function that the ActionForm can then call.I dunno which is better, but I wouldn't blindly go around and change everything into a ActionForm.
As for 1: a hidden Input seems the way to go.
As for 2: Imho everything that returns a view should be a component. So yes i would change it to be a component and use just a plain Action