fix(snap), avoid importing-delta when isolating non-modified comps #7284
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.
When isolating non-modified components into capsules, the dists are written from the artifacts saved in the scope.
If checked out to a lane, sometimes we don't know whether the requested id is on the lane and therefore the artifacts should be fetched from the lane-scope or it's on main and the import should go to the original scope.
To determine this better we fetch delta from both main and lane so then we could traverse the history and find out whether it's on main or lane.
Thing is that in most cases, this import is not needed and we're able to easily determine whether a component is on a lane, especially because we have the VersionHistory object.
This PR skips the import, and in case we're unable to determine the origin due to missing Version object, it tries to find the dists on both, the lane and main.