- Issue created by @mglaman
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
mglaman β credited larowlan β .
- πΊπΈUnited States mglaman WI, USA
laurii, larowlan were part of the debugging crew
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Ah the curse of a unit test with mocking :) https://git.drupalcode.org/project/experience_builder/-/merge_requests/7...
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
I've written a test here
And I think this behavior might be by design.If we delete the JS component then the component is deleted too.
And we don't want that if the component has usages, so that opens a can of worms about finding usages.
Do we want to tackle that here too or more likely we'll have to create issues to handle those pieces and postpone this.I've pushed up a test, but because of the 'are we using this component question - I don't think this one is a simple fix .
Linking a related entity usage system - but we could also implement something like layout builder does for inline block usage.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Assigning to Wim for direction on how we should go here.
I think trying to calculate the usage in real-time in a deletion check is arduous.
I think something like layout builder's inline block usage where we store usage in a table that we write when a component tree is saved AND that can be re-calculated (ala entity usage module) is probably more robust. - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
And we don't want that if the component has usages, so that opens a can of worms about finding usages.
Do we want to tackle that here too or more likely we'll have to create issues to handle those pieces and postpone this.I think trying to calculate the usage in real-time in a deletion check is arduous.
π― to all this! π€
π Detailed thoughts: https://git.drupalcode.org/project/experience_builder/-/merge_requests/9... β
tl;dr
: implementComponent::onDependencyRemoval()
. See #3484682-12: Handle update and delete of Block `Component`s, plus missing config dependencies β , where @longwave is hitting on the exact same problem with a differentComponentSource
plugin! - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Added a fallback source plugin that can step in and continue to render children when a JS component is removed if any instance exist.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Lots of cleverness here, but also some huge long-term impact decisions!
This is sort of a counterpart to π± [META] Robust component instance error handling Active , at least if I interpreted everything correctly.
I'd like @longwave to take a very critical look at this, because this has just shifted to a critical data integrity issue. π