Added manual cache update on rename #814
Merged
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.
Changes in this pull request
Resolves #753
Additional info
This pull request includes several changes to the
assets/js/src/core/modules/element/hooks
andassets/js/src/core/components/drag-and-drop/draggable.tsx
files to improve functionality and maintainability. The most important changes include the addition of a new hook for cache updates, integration of this hook into existing APIs, and a minor fix in theDraggable
component.New Hook for Cache Updates:
assets/js/src/core/modules/element/hooks/use-cache-update.ts
: Added a new hookuseCacheUpdate
to handle cache updates for assets and data objects. This hook provides methods to update cache entries and field values.Integration of Cache Update Hook:
assets/js/src/core/modules/element/hooks/use-element-api.ts
: Integrated theuseCacheUpdate
hook into theuseElementApi
hook to update cache entries after patching assets and data objects. This includes importing the new hook and using its methods in theelementPatch
function. [1] [2]Minor Fix:
assets/js/src/core/components/drag-and-drop/draggable.tsx
: Fixed the dependency array in theDraggable
component'suseMemo
hook to includeprops.children
for proper memoization.