You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The content node copy operation was assuming the relevant nodes were already loaded, which in the case of importing from search, wasn't true.
This PR unwraps code out of a transaction such that we can use our resource methods that will attempt to retrieve the object from our API if it's not present locally or is stale. This required unwrapping it because the API response must be inserted into the IndexedDB. To prevent against edge cases that could cause inconsistencies in rapid calls to ContentNode.copy or .move, I added a small in-memory locking memory to ensure that if it does retrieve objects from the API, the operations should still happen in order.
Thanks @rtibbles and @MisRob , I made a mistake in my test that didn't capture the fact that fetching a model would then put it into IndexedDB, which requires a transaction to set the source as fetch. I'll work on refactoring to get around this, and add more tests!
bjester
changed the title
Ensures nodes are loaded prior to copy, a use case for importing from searchWIP: Ensures nodes are loaded prior to copy, a use case for importing from searchJan 26, 2021
bjester
changed the title
WIP: Ensures nodes are loaded prior to copy, a use case for importing from searchEnsures nodes are loaded prior to copy, a use case for importing from searchJan 27, 2021
The reason will be displayed to describe this comment to others. Learn more.
Could avoid the subclassing here and just pass treeLock method as an option to the Resource constructor for ContentNode - and add in an existence check for this._locks - but class extension works too!
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
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.
Description
The content node copy operation was assuming the relevant nodes were already loaded, which in the case of importing from search, wasn't true.
This PR unwraps code out of a transaction such that we can use our resource methods that will attempt to retrieve the object from our API if it's not present locally or is stale. This required unwrapping it because the API response must be inserted into the IndexedDB. To prevent against edge cases that could cause inconsistencies in rapid calls to
ContentNode.copyor.move, I added a small in-memory locking memory to ensure that if it does retrieve objects from the API, the operations should still happen in order.Issue Addressed (if applicable)
Resolves: #2820
Steps to Test
Preconditions: A channel created.
Checklist