feat: expose whole course metadata response in react query cache#249
feat: expose whole course metadata response in react query cache#249diana-villalvazo-wgu wants to merge 1 commit intoopenedx:mainfrom
Conversation
|
Thanks for the pull request, @diana-villalvazo-wgu! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
arbrandes
left a comment
There was a problem hiding this comment.
I understand that we want to minimize hitting the server, but I don't think this is a good pattern. In particular, I see three issues:
-
Coupling frontend-app-instructor-dashboard with a header implementation detail is a bad idea: what if we change the key or the query in the header? It's not a public API.
-
I don't believe this is how React Query is meant to be used. The whole point is you query for what you need, and let it worry about de-duplicating things. What you can be smart about, though, is taking advantage of it - maybe by making sure that what you're querying matches what's being queried elsewhere, so React Query can do its deduplication. In other words, let both the header and instructor-dash hit the same endpoint with duplicate queries, then let React Query deduplicate them.
-
anyis bad. Only use it if there's no other choice - evenunknownis better, if possible. But in this case, for a well formatted API response, there is really no reason not to type it properly.
|
We will handle it from instructor dash as a diff query key |
As part of the work done on Instructor Dashboard, some attributes from the course metadata request can be useful, so instead of doing the call again we can access to react query keys and get the info from the cache, in the current implementation only the tabs were returned from that api call, so i added all the attributes from the request so it can be used on any repo if they call the query key data.
Usage Example: openedx/frontend-app-instructor-dashboard#189
Data on React Query
Before

After
