-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: Pattern makes AutoLinkPlugin throw error: One or more transforms are endlessly triggering additional transforms #7646
Description
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:
- Content like
Check this out! #1234.Another thing...makesAutoLinkPluginthrow the error (because there's a period + non-space after#1234) - 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
- Clone the repo
- Install the dependencies (
npm install) - Run the app (
npm run start) - Check the browser console. The error should be logged there.
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.
