-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove query and site props passing from everywhere except class components #4340
Conversation
2f4a3f5
to
5fffacc
Compare
function MatchDayOfWeekInput({ history, query, site }) { | ||
function MatchDayOfWeekInput({ history }) { | ||
const site = useSiteContext() | ||
const { query } = useQueryContext() |
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.
Would something like useDashboardContext()
make sense which would encapsulate both site AND query? 🤔
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.
Thanks!
I considered it initially, but my hunch is that many of these components don't really need either.
I think the way forward is to actually remove some of these superfluous dependencies, and provide components with specific handlers for what they're supposed to do: in this example handleCompareExactMatch, handleCompareDayOfTheWeek.
Such handlers would be declared higher up in the React tree and themselves dependent on a shared API component, which is dependent on the site.domain.
|
336a058
to
3195912
Compare
|
1 similar comment
|
|
3195912
to
f41120f
Compare
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.
Didn't test it manually but the approach and code looks great! 🚢
…onents (#4340) * Remove query and site props passing from everywhere except class components * Fix invalid import
Changes
Followup to #4334, to further alleviate issues from props passing
Tests
Changelog
Documentation
Dark mode