Skip to content

Bug: Pattern makes AutoLinkPlugin throw error: One or more transforms are endlessly triggering additional transforms #7646

@daedmunoz

Description

@daedmunoz

I'm using lexical to display read-only content. I utilize AutoLinkPlugin to convert the pattern /#\d{4,}/ to a link (for example, #1234). I noticed that, starting from lexical version 0.16.1, when there's a period plus non-space after that pattern, AutoLinkPlugin throws the error One or more transforms are endlessly triggering additional transforms.

Examples:

  1. Content like Check this out! #1234.Another thing... makes AutoLinkPlugin throw the error (because there's a period + non-space after #1234)
  2. With content like Check this out! #1234. Another thing... the AutoLinkPlugin works fine (there's no period + non-space after #1234)

Lexical version: 0.32.1

Steps To Reproduce

  1. Clone the repo
  2. Install the dependencies (npm install)
  3. Run the app (npm run start)
  4. Check the browser console. The error should be logged there.

Image

Link to code example:

https://github.com/daedmunoz/lexical-autolink-issue

Everything is in file src/App.tsx. MATCHERS array with the pattern is below.

const MATCHERS = [
  createLinkMatcherWithRegExp(/#\d{4,}/, (text: string) => `/#/segment1/segment2/${text.replace("#", "")}`),
];

The current behavior

The content #1234 is not a link, and there's an error One or more transforms are endlessly triggering additional transforms logged in the console.

The expected behavior

The content #1234 should be a link, and there should be no One or more transforms are endlessly triggering additional transforms error in the console.

Impact of fix

The impact of this fix can be high since it is currenlty affecting some clients of the company I work for. In fact, that error is breaking the whole webapp when users visit the page when we display content with those patterns.

The temporal solution I found is to use a previous version of the plugin AutoLinkPlugin (v0.16.0) but it would be very nice that you guys fix this issue so that content like #1234.Someting else work in the last version of your amazing library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions