-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Feature: Migrate existing update tags to use exported constants #7446
Copy link
Copy link
Closed
Labels
enhancementImprovement over existing featureImprovement over existing feature
Description
Description
Following up on PR #7441, we need to migrate existing string literal update tags to use the newly introduced constants. This will improve type safety and maintainability by preventing typos and providing better IDE support through TypeScript.
This feature request aims to update all existing code that currently uses string literals (e.g., 'historic', 'skip-collab') to instead use the exported constants (e.g., HISTORIC_TAG, SKIP_COLLAB_TAG).
Related PR: #7441
Use Cases
- Developers using update tags in editor.update() will get TypeScript errors for typos:
// Before: No type checking
editor.update(() => {}, { tag: 'historic' }); // Typo-prone
// After: Type-safe
editor.update(() => {}, { tag: HISTORIC_TAG }); // IDE autocomplete & type checking- Code maintainers can easily track usage of specific update tags through IDE "Find References" feature
- Documentation and implementation stay in sync as both use the same constants
Additional Context
Files that need to be updated include:
- packages/lexical-yjs/src/SyncEditorStates.ts
- packages/lexical-history/src/index.ts
- packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx
And other files using string literals for update tags.
Impact
- Benefits all Lexical developers by providing better type safety
- Would improve maintainability for approximately 20+ files in the codebase
- No breaking changes as the string values remain the same
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementImprovement over existing featureImprovement over existing feature