-
Notifications
You must be signed in to change notification settings - Fork 17
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
Refactor/trpc #18
Merged
Merged
Refactor/trpc #18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… reset. add cascade deletion to select models
…rovider to detect loss of session
…validation options
jthrilly
force-pushed
the
refactor/trpc
branch
from
October 4, 2023 07:57
3221fdd
to
bf8d985
Compare
…t-management-functionality Refactor/participant management functionality
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains a fairly significant update to the tRPC implementation, based on things I have learned since the initial attempt.
Specifically:
RedirectWrapper
component under the root layout. This client side component calculates if a redirection is needed based on the path (which is now available viauseRouter
, meaning no middleware header injection is required). This solves the infinite update depth errors, and allows us to use the router for navigation again.window.location
in favour of router methods.SessionProvider
by correctly setting the initialData for the client side query, and refreshing the router when the session changes to null from having previously been defined (allowing the app to redirect to login across multiple tabs).It also makes several other quality of life changes:
process.env
in favour of our environment helperuseZodForm
hook which provides better ergonomics for working withzod
+react-hook-form
usePrevious
hook, which allows you to track the previous value of a state item or prop, which can be used inside ofuseEffect
for comparing.onDelete: Cascade
to several of our models, meaning that relations won't be invalidated by deleting various entities.I'm going to branch off of this now and do some refactoring of the current client-side data fetching that is going on.