facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
17.5k stars 1.45k forks source link

Feature: document and export common/known update tags #5992

Open etrepum opened 2 weeks ago

etrepum commented 2 weeks ago

If we export the update tags that are used internally it'll be easier to document what they're for and people will be less likely to make a typo which is hard to debug since it's used as an extensible Set<string> and there is no way a dev mode would be able to detect 'unregistered' use since there is no registration process like commands.

Some examples in the monorepo that I'm aware of:

It might also be a good time to think about how and whether updates with different tags should really be merged, since you could have two updates in the same tick with very different semantics. It might be the case that for correct behavior they should be reconciled separately at least if they were not part of the same top-level update. It seems reasonable that cascading transforms and any other sort of explicit nested update should inherit tags but if the updates were completely separate it might not make sense. I think this sort of bug would be very hard to catch and reproduce, and tags are probably used rarely enough that it wouldn't be a performance impact to reconcile more than once in a tick (iff updates with different tag sets are to be combined) to avoid this kind of incoherence.