From 299fd37460f0e75b7e03aa22946dde709f0ccb97 Mon Sep 17 00:00:00 2001 From: Sherry Date: Tue, 2 Jun 2026 14:16:31 +0800 Subject: [PATCH] Include editor namespace in infinite-update-loop detector error (#8612) --- packages/lexical/src/LexicalUpdates.ts | 3 ++- packages/lexical/src/__tests__/unit/LexicalEditor.test.tsx | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/lexical/src/LexicalUpdates.ts b/packages/lexical/src/LexicalUpdates.ts index 09f2862e6c0..c4cc487f8a6 100644 --- a/packages/lexical/src/LexicalUpdates.ts +++ b/packages/lexical/src/LexicalUpdates.ts @@ -880,7 +880,8 @@ function $triggerEnqueuedUpdates(editor: LexicalEditor): void { try { invariant( false, - 'One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition.', + 'One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: %s', + editor._config.namespace, ); } catch (error) { if (error instanceof Error) { diff --git a/packages/lexical/src/__tests__/unit/LexicalEditor.test.tsx b/packages/lexical/src/__tests__/unit/LexicalEditor.test.tsx index af41d460402..31fef348514 100644 --- a/packages/lexical/src/__tests__/unit/LexicalEditor.test.tsx +++ b/packages/lexical/src/__tests__/unit/LexicalEditor.test.tsx @@ -1216,6 +1216,12 @@ describe('LexicalEditor tests', () => { expect(errorListener.mock.calls[0][0].message).toMatch( /endlessly enqueueing/, ); + // The error message should include the editor's namespace so the loop can + // be attributed to a specific product/editor in error aggregation, even + // when the production stack is minified to core frames. + expect(errorListener.mock.calls[0][0].message).toContain( + `Editor namespace: ${editor._config.namespace}`, + ); unregisterListener();