-
Notifications
You must be signed in to change notification settings - Fork 53
refactor: zero duplicate queries #483
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: zero duplicate queries #483
Conversation
This branch is behind commaai/master. The line count diff bot is disabled. |
deployed preview: https://483.connect-d5y.pages.devWelcome to connect! Make sure to:
MobileDesktop |
4dec73a
to
62876a6
Compare
Doesn't seem to load yet |
its very broken rn, give me a few |
loads now but it's way more buggy the edge case is when the user loads a route directly. hacking the fallback to state is not working consistently. not to mention it's disgusting |
i'll play with this idea some more later, or anyone's welcome to pull this and play with it locally |
man, it absolutely rips though... this is the sort of speed we can expect with no dupe queries |
export const useAppContext = () => { | ||
const context = useContext(AppContext) | ||
if (!context) throw new Error('Could not find an AppContext!') | ||
return context | ||
} |
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.
What does all this get us over global signals like commaai/connect#503?
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.
flexible usage. you import this wherever you need it without having to pass signals down the component tree
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 left more analysis on your PR
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.
We can do that with global signals AFAIK too
just a wip; store current metadata in a Context
won't end up merging this, will break it up if we like it