-
Notifications
You must be signed in to change notification settings - Fork 10
Media/refactor hooks #715
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
Merged
Merged
Media/refactor hooks #715
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Dec 19, 2021
Merged
Merged
Merged
Closed
alexanderleegs
approved these changes
Dec 21, 2021
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.
lgtm!
Merged
gweiying
added a commit
that referenced
this pull request
Feb 4, 2022
* Media/refactor hooks (#715) * feat(hooks): add media CRUD hooks * fix(hooks): update query invalidation logic for media CRUD directories * fix(hooks): update query invalidation logic for media move * nit: clean up unused variables and copy * fix: update with correct query key params * Media/refactor components (#716) * refactor(Breadcrumb): update Breadcrumb to parse mediaDirectoryName * refactor(Breadcrumb): update BreadcrumbItem to accept onClick argument * fix(Breadcrumb): update CSS and fix typo in resource links * refactor(move): create move components * refactor(move): update page move modal with new components * refactor(media): remove inline queries & upload handler from media select modal * refactor(media): create parent component for media upload input html component * refactor(media): add modal and yep schema validation for media settings * refactor(media): add parent media component for media actions (upload, select, alt-text) * refactor(media): update EditorModals and FormFieldMedia to use parent media component for actions * refactor(media): add media move modal * refactor(media): update FolderCard and MediaCard * refactor(media): update DirectoryCreation and DirectorySettings for media directories support * nit: fix extra ~ in copy for special characters error * chore: update sidebar links for media directories * chore: clean up unused components * chore: add media utils and validators * refactor(media): add medial modal for alt-text input * fix: allow # in media directory names * fix: update handling for retrieved mediaDatas * Media/refactor tests (#717) * chore: update button copy and button ids in tests * chore: add alt text copy for EditPage insert media test * chore: update resource tests for refactored FormFieldMedia component * chore: update images and files tests for refactored Media flows * chore: add waits for flaky test timeouts * chore: fix flaky tests * Media/refactor layouts (#719) * refactor(screens): generalize PageMoveScreen to handle both pages and media * fix: update references to MoveScreen * feat(screens): add MediaCreation and MediaSettings screens * refactor(screens): update DirectoryCreation and DirectorySettings to support media directories * refactor(screens): update DeleteWarning to support media * refactor(Media): update Media layout: - remove inline react query - remove inline upload handler - replace inline states with url params * chore: update frontend routes * fix: add missing variable for ResourceCategory layout * refactor(media): add medial modal for alt-text input * chore: encode media directory link in FolderCard * Media/refactor services (#743) * feat: add media CRUD services * fix(services): update directory services with media endpoints and handlers * fix(services): update mover services with media endpoints * chore: add mediaServices to servicesContext * chore: update documentation of endpoints
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds custom React query hooks for the media CRUD operations, and updates the existing directory hooks with media directory invalidation and caching logic.
Implementation
The media CRUD React query hooks differ from previous hooks.
As the media retrieval is slower and more resource-heavy, we use React Query's
setQueryData
details to immediately create cached copies of the media content. We use this caching for the following scenarios:We can also consider in the future extending this to the renaming of media directories as that is also fairly slow, however this is not currently supported on the backend as the backend does not return the new directory name. As this is unlikely to be a common issue, we can consider this in the future.
Others
This PR does not provide any standalone functionality and is meant to be reviewed with #716, #717, #718, and #719. However this PR is backward compatible and does not break existing functionality.