feat: course libraries review tab [FC-0076]#1699
Conversation
|
Thanks for the pull request, @navinkarkera! 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. |
| const { data: downstreamInfo, isLoading: isIndexDataLoading } = useFetchIndexDocuments({ | ||
| filter: [`context_key = "${courseId}"`, `usage_key IN ["${downstreamKeys?.join('","')}"]`], | ||
| limit: downstreamKeys?.length || 0, | ||
| attributesToRetrieve: ['usage_key', 'display_name', 'breadcrumbs', 'block_type'], | ||
| sort: [searchSortOrder], | ||
| searchKeywords, | ||
| enabled: !!outOfSyncComponents, | ||
| }) as unknown as { data: ContentHit[], isLoading: boolean }; |
There was a problem hiding this comment.
Question: can you just use fetchSearchResults here? Why do we need to add searchKeywords to fetchIndexDocuments? And if you do that, what is the purpose of fetchIndexDocuments compared to fetchSearchResults?
Is the difference that fetchIndexDocuments is always used when you have a specific document ID or a list of IDs to retrieve? Or is the difference a SearchContext or not? Whatever the distinction is, we should document it more clearly.
There was a problem hiding this comment.
@bradenmacdonald Initially, I was trying to use meilisearch getDocuments but it does not work with tenant tokens, so switched to search api. But later on search became useful for link filtering. Now I have refactored it and removed this new hook and api function and used SearchContext and fetchSearchResults.
| postChange: () => void, | ||
| } | ||
|
|
||
| export const BasePreviewLibraryXBlockChanges = ({ |
There was a problem hiding this comment.
Nit: It's unclear from the names what's the difference between BasePreviewLibraryXBlockChanges and PreviewLibraryXBlockChanges. JSdoc comments would also be helpful.
There was a problem hiding this comment.
@bradenmacdonald Renamed and added documentation as well. JSdoc with typescript files seems to raise warnings.
There was a problem hiding this comment.
I just mean the most basic JSdoc comments describing what each thing is, not necessarily adding type info etc.
0477a28 to
6a3c507
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1699 +/- ##
==========================================
+ Coverage 93.44% 93.47% +0.03%
==========================================
Files 1112 1113 +1
Lines 22333 22467 +134
Branches 4739 4849 +110
==========================================
+ Hits 20868 21000 +132
- Misses 1400 1402 +2
Partials 65 65 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3eab90d to
35cfb4c
Compare
bradenmacdonald
left a comment
There was a problem hiding this comment.
Thanks, looking good! This is a huge PR though.
| } | ||
| }; | ||
|
|
||
| const updateBlock = async (info: ContentHit) => { |
There was a problem hiding this comment.
Since these functions like updateBlock are not using useCallback, they'll be re-created every time this component is re-rendered, e.g. every time the searchKeywords change. That may be totally fine, but it could also cause slow performance when typing search keywords on a page with many libraries. Keep an eye on it.
There was a problem hiding this comment.
Makes sense. Updated
pomegranited
left a comment
There was a problem hiding this comment.
Working great @navinkarkera ! Just a couple of small issues -- let me know if you need another review?
- I tested this on my tutor dev stack
- I read through the code
- I checked for accessibility issues by using my keyboard to navigate
- Includes documentation -- docstrings
- User-facing strings are extracted for translation
| const dismissAlert = () => { | ||
| setShowAlert(false); | ||
| localStorage.setItem(alertKey, String(outOfSyncCount)); | ||
| onDismiss?.(); |
There was a problem hiding this comment.
Shouldn't onDismiss be a required prop if we force call it here?
There was a problem hiding this comment.
It is only called if defined, notice the ?. before brackets.
| searchSortOrder: SearchSortOption; | ||
| hasError: boolean; | ||
| }; | ||
| const outOfSyncComponentsByKey = useMemo( |
There was a problem hiding this comment.
nit: If I open the Unit page and the Review page in separate tabs, then Accept/Ignore updates from the Unit page, I can't see the updated components to review on this tab unless I refresh this Review page.
Not sure if useMemo is causing this, or if it's something about the react-query keys not detecting the change?
There was a problem hiding this comment.
@pomegranited I am not sure about this. React query doesn't really keep track of other tabs, so invalidating keys is only triggered in current tab. You can test this by keeping the same page open in two tabs. Let me know if I am missing something.
| * Wrapper over PreviewLibraryXBlockChanges to preview two xblock versions in a modal | ||
| * that depends on iframe message events to setBlockData and display modal. | ||
| */ | ||
| const IframePreviewLibraryXBlockChanges = () => { |
There was a problem hiding this comment.
I'm seeing some broken modal behavior when I view this preview modal/iframe (happens in both Firefox and Chrome):
scrolling.weirdness.mp4
There was a problem hiding this comment.
@pomegranited This is an issue with paragon, if you zoom and scroll in paragon example you can see the same issue:
Setting isOverflowVisible={false} fixes it by adding a scroll inside the dialog when the screen is small. Fixed: 7cb3501
navinkarkera
left a comment
There was a problem hiding this comment.
@bradenmacdonald @pomegranited Thank you for the review and apologies for the big PR. I should have found a way to split it 😅
| const dismissAlert = () => { | ||
| setShowAlert(false); | ||
| localStorage.setItem(alertKey, String(outOfSyncCount)); | ||
| onDismiss?.(); |
There was a problem hiding this comment.
It is only called if defined, notice the ?. before brackets.
| * Wrapper over PreviewLibraryXBlockChanges to preview two xblock versions in a modal | ||
| * that depends on iframe message events to setBlockData and display modal. | ||
| */ | ||
| const IframePreviewLibraryXBlockChanges = () => { |
There was a problem hiding this comment.
@pomegranited This is an issue with paragon, if you zoom and scroll in paragon example you can see the same issue:
Setting isOverflowVisible={false} fixes it by adding a scroll inside the dialog when the screen is small. Fixed: 7cb3501
| searchSortOrder: SearchSortOption; | ||
| hasError: boolean; | ||
| }; | ||
| const outOfSyncComponentsByKey = useMemo( |
There was a problem hiding this comment.
@pomegranited I am not sure about this. React query doesn't really keep track of other tabs, so invalidating keys is only triggered in current tab. You can test this by keeping the same page open in two tabs. Let me know if I am missing something.
| } | ||
| }; | ||
|
|
||
| const updateBlock = async (info: ContentHit) => { |
There was a problem hiding this comment.
Makes sense. Updated
ChrisChV
left a comment
There was a problem hiding this comment.
Looks good! With some nits
689e0dd to
e74c556
Compare
e74c556 to
ec8c47c
Compare
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Description
Adds review tab to course libraries page. Also refactors all libraries page as per new designs.
Useful information to include:
Screenshots:
Supporting information
Private-ref: FAL-4007Also addresses following comments
Testing instructions
tutor images build openedx-dev && tutor dev launch -I --skip-build.Content > Librariesnavigation menu item.Library Contentpicker, copy & paste orProblem bankoption.Other information
Include anything else that will help reviewers and consumers understand the change.