Best approach for models?
Unanswered
Harlequin posted this in #help-forum
HarlequinOP
I have a dashboard that allows users to create new items, the form appears via a modal, it needs to load data to display the fields and should fire off a request when submitted.
I tried parallel routes for this but this means the URL has to be updated to something like ?action=create-item which isn't ideal. As opening and closing the modal triggers history for the user.
Is there another approach that keeps server components so the form can be fetched and rendered on the server, but still be easily displayed in a modal that is performant, eg not fetched and rendered unless the modal is triggered.
Parallel routes splits up the code nicely but it's just the URL changing that isn't ideal. I don't need stateful urls for this functionality.
There's a likely future requirement that there would be multiple modal forms possible for various actions.
I tried parallel routes for this but this means the URL has to be updated to something like ?action=create-item which isn't ideal. As opening and closing the modal triggers history for the user.
Is there another approach that keeps server components so the form can be fetched and rendered on the server, but still be easily displayed in a modal that is performant, eg not fetched and rendered unless the modal is triggered.
Parallel routes splits up the code nicely but it's just the URL changing that isn't ideal. I don't need stateful urls for this functionality.
There's a likely future requirement that there would be multiple modal forms possible for various actions.
2 Replies
HarlequinOP
Anyone have any advice here?
@Harlequin Anyone have any advice here?
1. use parallel route. for the location history issue, you could use
2. use client state and client side fetching since dashboard application doesn't need to be SSR?
<Link replace /> instead.2. use client state and client side fetching since dashboard application doesn't need to be SSR?