-
Notifications
You must be signed in to change notification settings - Fork 11
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
Thread post action does not have a proper loading state #227
Comments
I like to work on this issue. can you explain more about issue ? |
Absolutely @programmingwithrp! This can probably be done in two parts: the loading indicator on the button and the actual hook side of things. I'll detail the hook side first as it's probably slightly more complex. Mutations in Storyden's codebaseMost API calls made from event handlers (such as form submissions, button clicks, etc) are wrapped in a function called Currently, the compose form does not use this in its hook instead it just fires the API call directly in the A good example to copy would be the Create Page Action which wraps the API call to create a page and uses the Revalidation is most likely not necessary to handle with creating a post, because there's nothing to revalidate. The user hits post and is immediately redirected to the new thread's page once the API call finishes so there's no need to worry about any optimistic mutation of data like with other features. Some other bits of cleanup around here around naming: doSave -> handleSaveDraft, doPublish -> handlePublish - generally, nowadays I've leaned towards naming actual handlers Thank you for offering to take this issue, it's hugely appreciated especially since this is a fairly new open source project! Let me know if you have any questions! Feel free to make any changes/tidying up/best practices you see fit! |
The button side of things may need some understanding of Panda CSS, Ark UI and the preset Park-UI. I typically copy the presets directly into Storyden's codebase (recipes/[component].ts) and use that instead of Park's CLI tool (mostly because I make minor changes to the underlying recipes anyway to fit the design system) The Button component was copied in a long time ago, and since then it has been updated I generally avoid too much complexity around these UI components if possible, so I'd probably combine the "Add styled primitive" and "Add composition" into a single file+component (it also keeps typechecks fast as lots of composition can sometimes slow down tsc and the build) In the Park UI code, it's not immediately clear to me why it needs a forwarded ref as the spinner just needs to be swapped in when |
The useFeedMutation (or another hook, specifically for posting new threads) should properly handle loading states after clicking "Post":
handle(..., { promiseToast })
The text was updated successfully, but these errors were encountered: