Closed lowtorola closed 7 months ago
Just noting that generated files are currently duplicated but that will be fixed once everything runs from src/api
😎
@acrantel Could you please take a look at EligibilitySettings.tsx
, ScrimmageSettings.tsx
, and MyTeam.tsx
to address some of the ideas I left behind while tearing out TeamContext
? We can also take a look at this during our hack session, but I think if you can take a look at this then I can finish this PR this week (with UserContext
updated as well 😎).
Huge progress on react querifying! Next step is fixing Eligibility/Scrim Settings sections. Then, I think I can tackle React Router loaders on this PR. Only problem is, I think that will make it necessary to refactor the queryKey/queryFn
pairs for each hook to reuse on the loader functions. Also, I think I will refactor a prefetchNextPage
function that many of our use<Model>List
hooks use! So we will see how I feel after fixing UIs (whether things are on this/other PR). Maybe will depend on timing of user pages, etc.
@acrantel Progress update: I finished reworking EligibilitySettings
, ScrimmageSettings
, and MyTeam
as well as implementing the useTeam and useCompete hooks across the FE. Once the useUser hooks are in from your side I think we can do a mega-test on this and merge!! 🎉
Going to yeet the test files that are breaking CI 😢 maybe we will add real unit tests someday lol
WHOOOO 🎉 🎉 🎉
Adds React Query as
frontend2
's async state manager! Plus, restructures our api!New API structure:
src/api/
: folder for all api code_autogen
: ALL auto-generated code. Frontend code should only import models and types from this folder!"endpoint"
: Each API endpoint (e.g. episode, team, compete,...) gets its own sub-folder. Below is an example for episode to explain the layout.episodeApi.ts
: Wrapper instance methods for theEpisodeApi
class. Basically just prettifying/safety enforcement through only exporting safe (non-"raw") functions.episodeKeys.ts
:react-query
key factories for all Episode mutations and queries. These standardize the tags each api call is associated to in thequeryClient
cache, and simplifies query prefetching and invalidation.useEpisode.ts
: This holds all of our custom hooks that abstract away thequeryKeys
and other configuration parameters ofuseQuery
anduseMutation
.