Mapper bindings are removed too late when reconversion is involved #15411
Labels
package:engine
squad:collaboration
Issue to be handled by the Collaboration team.
support:2
An issue reported by a commercially licensed client.
type:bug
This issue reports a buggy (incorrect) behavior.
Milestone
📝 Provide detailed reproduction steps (if any)
Okay, I know the title says it all. But this is a very technical issue.
This is
DowncastDispatcher#converChanges()
with unimportant parts removed:The following happens:
( 1 )
some elements are removed and reinserted.( 1 )
), instead it is deferred to( 3 )
.( 2 )
.( 3 )
.( 3 )
we add markers to unbound marker names.( 2 )
. This means that the markers are not refreshed at( 2 )
and they are still cached in the mapper.Mapper#flushUnboundMarkerNames()
.To solve this, we need to
flushDeferredBindings()
as soon as possible, i.e., straight after( 1 )
.Side note -- why didn't this crash earlier? Steps 1-9 are the same no matter if reconversion is involved or not...
First, this crashes only if the marker path has not changed and it was the mapper who found a view element with a marker inside and added it to unbound marker names. The mapper can do it only if the marker was not registered to be refreshed in the differ.
Second, this crashes only if an element is removed and it had a marker. Element is removed in four cases: it is removed (duh), it is merged, it is renamed, it is reconverted.
When element is removed and merged, the marker path changes. We listen to that and inform differ that it should be refreshed. When element is renamed, differ itself looks for markers inside such element and refreshes them.
Reconversion is the only mechanism that does not refresh markers in the differ and lets mapper find them and add to unbound marker names. And we use reconversion rarely.
The text was updated successfully, but these errors were encountered: