-
Notifications
You must be signed in to change notification settings - Fork 12
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
Create template modal #757
Conversation
This was done to use the server actions without having to use the experimental flag, it was release in v14 and since we are using next I think it is worth using the features that are driving the framework development
This class is created to improve the error handling through the code and t make it easier to create new errors
This modal contains the form to save a task as a template
This SubmitButton is a regular button but it uses the useFormStatus hook to get the "pending" state from form to know if it should or shouldn't be disabled.
This commit doubles down on the next js capabilities, by using new the server actions it makes a lot of states tracking and useEffects unnecessary thus making us write less code to have the same features
This commit changes the structure for the apiClient dependecy injection, it exports a makeCreateTemplate function that receives the apiClient as prop and return the createTemplate function, I made this change because I think this pattern is easier to follow through the application. Also I intend to change the other api calls in future pr's.
The Jest transformer breaks with some server libs that are used by the server actions, this globally mocks the next-auth session so we don't have to worry about it ever again.
fdbc4bf
to
99fbed5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the naming nit, looks good to me! I also tested locally and it works well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @anarute on the naming, but this otherwise looks good to me.
Create save task as template modal.
Instead of having controlled inputs and react query I tried using the new server actions from next js v14 to submit the form. I like the result of it, it save us from writing more code to track the fetch states, and having to use more hooks.
Screencast.from.2023-12-29.18-23-09.webm