Skip to content
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

fix: discard changes [FC-0062] #58

Conversation

navinkarkera
Copy link
Member

@navinkarkera navinkarkera commented Aug 7, 2024

Related PRs:

Issue: openedx#1200

Test instructions:

  • Setup latest tutor nightly locally.
  • Install https://github.com/open-craft/tutor-contrib-meilisearch and enable the plugin
  • Checkout above PRs from edx-platform and openedx-learning.
  • Mount both the directories in tutor using tutor mounts add <path>.
  • Start tutor using tutor dev launch -I
  • Go to studio -> Libraries and create a new library.
  • Create some components and click on publish button in the sidebar.
  • Verify that everything is saved.
  • Add some more components and click on Discard changes button in sidebar.
  • Verify that newly created components are not visible.

Enable it if components are added.
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (chris/FAL-3760-library-info-sidebar@2ad5b1f). Learn more about missing BASE report.

Additional details and impacted files
@@                          Coverage Diff                           @@
##             chris/FAL-3760-library-info-sidebar      #58   +/-   ##
======================================================================
  Coverage                                       ?   92.97%           
======================================================================
  Files                                          ?      756           
  Lines                                          ?    13628           
  Branches                                       ?     2946           
======================================================================
  Hits                                           ?    12670           
  Misses                                         ?      922           
  Partials                                       ?       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@navinkarkera navinkarkera changed the title fix: discard changes fix: discard changes [FAL-3797] Aug 12, 2024
@navinkarkera navinkarkera changed the title fix: discard changes [FAL-3797] fix: discard changes [FC-0062] Aug 12, 2024
Copy link
Member

@ChrisChV ChrisChV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@navinkarkera Looks good, great work 👍

  • I tested this: I followed the testing instructions. I tested with a new library, a tested after publish a library and I tested the discard changes with multiple updates
  • I read through the code and considered the security, stability and performance implications of the changes.
  • I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
  • Includes tests for bugfixes and/or features added.
  • Includes documentation
  • Includes fixtures that create objects required for manual testing.

@@ -101,6 +101,7 @@ export const useRevertLibraryChanges = () => {
mutationFn: revertLibraryChanges,
onSettled: (_data, _error, libraryId) => {
queryClient.invalidateQueries({ queryKey: libraryAuthoringQueryKeys.contentLibrary(libraryId) });
queryClient.invalidateQueries({ queryKey: ['content_search'] });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: is it really necessary to invalidate all cached data related to content search?

Nit: it would be nice to convert this to the query key pattern like we're doing above for library authoring query keys.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: is it really necessary to invalidate all cached data related to content search?

@bradenmacdonald Actually, I only want to invalidate content search queries related to this library. So updated the new PR: openedx#1214 to include this commit: openedx@9a3fc04

I tried changing content search queries to use query key pattern but it has a lot of dynamic variables and I could not think of a nice way to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants