-
Notifications
You must be signed in to change notification settings - Fork 148
Load waffle flags using React Query #2068
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
Load waffle flags using React Query #2068
Conversation
Thanks for the pull request, @bradenmacdonald! 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. Where 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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2068 +/- ##
==========================================
+ Coverage 94.01% 94.03% +0.01%
==========================================
Files 1162 1163 +1
Lines 24434 24441 +7
Branches 5187 5305 +118
==========================================
+ Hits 22972 22982 +10
+ Misses 1394 1382 -12
- Partials 68 77 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
105a409
to
fca6ccc
Compare
Sandbox deployment successful 🚀 |
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.
Looks great. Some non-blocking questions, one request for a longer comment.
I read the code and unit tests, and tested manually on the PR sandbox by adding contentstore.use_react_markdown_editor
and confirming that it causes "Switch to Markdown editor" to show up for new problems. I tested with both:
- instance-level Waffle-on
- instance-level Waffle-off, and course-level Waffle-on
src/data/api.ts
Outdated
| 'useVideoGalleryFlow' | ||
); | ||
|
||
/** The default values of waffle flags. helpful if you're overriding them for a test case. */ |
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.
Can you say more about these? They're not actually edx-platform defaults; rather, they're the default that we test with, right? Or do these defaults actually have significance on the app?
(I see you pulled these from an existing object in src/data/slice.js, so I'm not trying to nitpick this too much, just looking for clarity).
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.
Oh interesting. I assumed that these defaults matched the platform defaults. These are what the MFE will assume while it's waiting to load the actual values from the server. (If we don't want to assume anything, components that depend on waffle flags should block rendering until isLoading
is false, but I think that's a worse experience.)
I would suggest that we follow this up with a PR to either change these defaults to match the platform defaults, or change the platform defaults to match these. But I think that should be isolated to a separate change, since this PR is trying to be an internal refactor that doesn't change behavior meaningfully.
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.
Yeah, I don't think you should fix these in this PR. Could you just amend your comment to say something like "frontend defaults if we fail to load flags from edx-platform -- may drift from edx-platform's actual defaults".
If you feel moved to, you could write an issue and link it here, but I'm not losing sleep over it. FWIW, my inclination here is actually "turn everything on by default in order to maximize test coverage" rather than "try to keep lockstep with edx-platform."
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 created a GitHub issue #2094 and put it into the comments.
@bradenmacdonald Btw, can you confirm whether you're looking to backport this to Teak? I think it would be good to have the markdown editor working in libraries. |
@kdmccormick I could backport a more targeted PR to Teak. i.e. instead of this refactor ("don't pass it in to Editor from three places; check it in Editor"), I can just "pass it in to Editor from Library page too". |
@bradenmacdonald That would be great! |
Sandbox deployment failed 💥 |
Backport: #2098 But I think it's blocked on #2099 and I'm not sure who will take that fix on, so for now it's just indefinitely on hold. |
This fix is also achieved on master via 5991fd3 / openedx#2068 but this is a simpler fix, not a direct backport of that refactor.
* fix: enable markdown editor for problems in libraries too This fix is also achieved on master via 5991fd3 / #2068 but this is a simpler fix, not a direct backport of that refactor. * fix: remove duplicate markdown_edited save request (#2127) Removes the unnecessary duplicate save request of markdown_edited value to the backend. Part of: #2099 Backports: 62589ae --------- Co-authored-by: Muhammad Anas <[email protected]>
* fix: enable markdown editor for problems in libraries too This fix is also achieved on master via 5991fd3 / openedx#2068 but this is a simpler fix, not a direct backport of that refactor. * fix: remove duplicate markdown_edited save request (openedx#2127) Removes the unnecessary duplicate save request of markdown_edited value to the backend. Part of: openedx#2099 Backports: 62589ae --------- Co-authored-by: Muhammad Anas <[email protected]>
* fix: enable markdown editor for problems in libraries too This fix is also achieved on master via 5991fd3 / openedx#2068 but this is a simpler fix, not a direct backport of that refactor. * fix: remove duplicate markdown_edited save request (openedx#2127) Removes the unnecessary duplicate save request of markdown_edited value to the backend. Part of: openedx#2099 Backports: 62589ae --------- Co-authored-by: Muhammad Anas <[email protected]>
* fix: enable markdown editor for problems in libraries too This fix is also achieved on master via 5991fd3 / openedx#2068 but this is a simpler fix, not a direct backport of that refactor. * fix: remove duplicate markdown_edited save request (openedx#2127) Removes the unnecessary duplicate save request of markdown_edited value to the backend. Part of: openedx#2099 Backports: 62589ae --------- Co-authored-by: Muhammad Anas <[email protected]>
* fix: enable markdown editor for problems in libraries too This fix is also achieved on master via 5991fd3 / openedx#2068 but this is a simpler fix, not a direct backport of that refactor. * fix: remove duplicate markdown_edited save request (openedx#2127) Removes the unnecessary duplicate save request of markdown_edited value to the backend. Part of: openedx#2099 Backports: 62589ae --------- Co-authored-by: Muhammad Anas <[email protected]>
This PR moves waffle flags out of the redux state and loads them with React Query instead.
Features:
useNewHomePage: true
) will be instantly available to the application, but may change once the server responds with updated flags. If you need to not render something until you know its final value for sure, use theisLoading
status.mockWaffleFlags()
function is available for use in tests, though only one or two tests are actually using it.TODO:
How to test:
Verify some waffle flags are working. For example:
legacy_studio.advanced_settings
to True for Everyone. Now refresh, and the "Advanced Settings" menu in each course should go to the legacy Studio page. Then change it back to False (or remove it) and confirm "Advanced Settings" now stays in the MFE.contentstore.use_react_markdown_editor
waffle flag controls whether or not the "Switch to markdown editor" button appears. Note that it only works in brand new problems, not editing existing ones.