You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been rattling my brain on the best way to achieve this for the last few days as I'm developing a dashboard that has configurable layouts using next.js & prisma for the db
The problem boils down to syncing the saved layouts of the dashboard with what is local and what is stored in the database. If i do everything with local storage then it's immediately responsive and adding/removing/resizing widgets works perfectly, but when adding on fetching and saving to prisma I run into a lot of problems with the useQuery and useMutation hooks causing re-renders or not showing the new widget until page reload.
I've tried splitting out the hooks into a parent component but there are multiple places to add a widget from and i'm entering prop drilling hell. I think there's a fundamental architectural problem that I can't figure out here and any help or example projects with a DB in react would be amazing.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've been rattling my brain on the best way to achieve this for the last few days as I'm developing a dashboard that has configurable layouts using next.js & prisma for the db
The problem boils down to syncing the saved layouts of the dashboard with what is local and what is stored in the database. If i do everything with local storage then it's immediately responsive and adding/removing/resizing widgets works perfectly, but when adding on fetching and saving to prisma I run into a lot of problems with the useQuery and useMutation hooks causing re-renders or not showing the new widget until page reload.
I've tried splitting out the hooks into a parent component but there are multiple places to add a widget from and i'm entering prop drilling hell. I think there's a fundamental architectural problem that I can't figure out here and any help or example projects with a DB in react would be amazing.
Example of dashboard:
And Parent:
Beta Was this translation helpful? Give feedback.
All reactions