Skip to content

Feature: Migrate existing update tags to use exported constants #7446

@kirandash

Description

@kirandash

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

  1. 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
  1. Code maintainers can easily track usage of specific update tags through IDE "Find References" feature
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement over existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions