Feat/options to link delete restore #13767
Draft
+279
−3
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.
Summary
Hey guys, the intention of this is to start the conversation around enhancing the public API of link, particularily around restore and delete. I spent many hours looking at the code in Link module and I can't say i completely understand it, but from what I understood, I managed to update it and make it work like I intended, although I have a few doubts abouts tests that i would have expected to see fail that aren't which doesn't make me all that confident.
This feature request made me think about what is included in the PR: #13715
What — What changes are introduced in this PR?
Added an optional
options
object to link moduledelete
andrestore
methodsPlease provide answer here
Why — Why are these changes relevant or necessary?
The idea behind this is to allow users to:
options.exclude
setting.options.only
setting.Please provide answer here
How — How have these changes been implemented?
It was quite complex to understand what was going on, spent a few hours mapping out things and using Claude, so would like confirmation if what i did was okay.
It was weird to me why the already written test were passing, specifically for example
Should call delete in cascade all the modules involved in the link
when it asserts correctly:But on runtime I see the product variant is never soft deleted, only the relation links, like inventory item and price set, so would like to understand this (I wrote my tests for this based on the ones already there and don't understand why this assertion doesn't fail)
only
setting is specified,Please provide answer here
Testing — How have these changes been tested, or how can the reviewer test the feature?
Included tests for both options, but have a few doubts specified in the previous point.
Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
Checklist
Please ensure the following before requesting a review:
yarn changeset
and follow the promptsAdditional Context
Add any additional context, related issues, or references that might help the reviewer understand this PR.