Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diffToSuggestion - two children with the same key #3900

Open
mplemay opened this issue Dec 21, 2024 · 0 comments
Open

diffToSuggestion - two children with the same key #3900

mplemay opened this issue Dec 21, 2024 · 0 comments
Labels
bug Something isn't working plugin:suggestion

Comments

@mplemay
Copy link

mplemay commented Dec 21, 2024

Description

When using the diffToSuggestion function I ran into the following error:

Encountered two children with the same key, `provider-101`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

Reproduction URL

No response

Reproduction steps

const editor = useCreateEditor();
const v1 = deserializeMd(editor, content);

const v2 = deserializeMd(editor, suggestion);
replaceNodeChildren(editor, { at: [], nodes: diffToSuggestions(editor, v1, cloneDeep(v2)) });

Plate version

40.3.4

Slate React version

0.112.0

Screenshots

No response

Logs

Encountered two children with the same key, `provider-478`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version. Error Component Stack
    at Children (index.es.js:1473:160)
    at div (<anonymous>)
    at RestoreDOM (index.es.js:1453:5)
    at eval (index.es.js:1478:84)
    at Slate (index.es.js:2925:7)
    at PlateSlate (index.mjs:3681:3)
    at PlateContent (index.mjs:3700:20)
    at _c1 (editor.tsx:96:5)
    at div (<anonymous>)
    at EditorContainer (editor.tsx:32:2)
    at HydrateAtoms (index.mjs:111:5)
    at eval (index.mjs:132:20)
    at PlateInner (index.mjs:3452:3)
    at Plate (index.mjs:3485:58)
    at div (<anonymous>)
    at div (<anonymous>)
    at MarkdownAttachment (markdown.tsx:15:2)
    at Attachment (index.tsx:19:30)
    at Page (page.tsx:7:26)
    at ClientPageRoot (client-page.js:14:11)
    at InnerLayoutRouter (layout-router.js:229:11)
    at RedirectErrorBoundary (redirect-boundary.js:74:9)
    at RedirectBoundary (redirect-boundary.js:82:11)
    at NotFoundBoundary (not-found-boundary.js:84:11)
    at LoadingBoundary (layout-router.js:327:11)
    at ErrorBoundary (error-boundary.js:167:11)
    at InnerScrollAndFocusHandler (layout-router.js:139:9)
    at ScrollAndFocusHandler (layout-router.js:214:11)
    at RenderFromTemplateContext (render-from-template-context.js:16:44)
    at OuterLayoutRouter (layout-router.js:348:11)
    at InnerLayoutRouter (layout-router.js:229:11)
    at RedirectErrorBoundary (redirect-boundary.js:74:9)
    at RedirectBoundary (redirect-boundary.js:82:11)
    at NotFoundBoundary (not-found-boundary.js:84:11)
    at LoadingBoundary (layout-router.js:327:11)
    at ErrorBoundary (error-boundary.js:167:11)
    at InnerScrollAndFocusHandler (layout-router.js:139:9)
    at ScrollAndFocusHandler (layout-router.js:214:11)
    at RenderFromTemplateContext (render-from-template-context.js:16:44)
    at OuterLayoutRouter (layout-router.js:348:11)
    at InnerLayoutRouter (layout-router.js:229:11)
    at RedirectErrorBoundary (redirect-boundary.js:74:9)
    at RedirectBoundary (redirect-boundary.js:82:11)
    at NotFoundBoundary (not-found-boundary.js:84:11)
    at LoadingBoundary (layout-router.js:327:11)
    at ErrorBoundary (error-boundary.js:167:11)
    at InnerScrollAndFocusHandler (layout-router.js:139:9)
    at ScrollAndFocusHandler (layout-router.js:214:11)
    at RenderFromTemplateContext (render-from-template-context.js:16:44)
    at OuterLayoutRouter (layout-router.js:348:11)
    at main (<anonymous>)
    at main (<anonymous>)
    at _c8 (sidebar.tsx:330:6)
    at div (<anonymous>)
    at Provider (index.mjs:34:15)
    at TooltipProvider (index.mjs:58:13)
    at SidebarProvider (sidebar.tsx:60:4)
    at Layout [Server] (<anonymous>)
    at InnerLayoutRouter (layout-router.js:229:11)
    at RedirectErrorBoundary (redirect-boundary.js:74:9)
    at RedirectBoundary (redirect-boundary.js:82:11)
    at NotFoundErrorBoundary (not-found-boundary.js:76:9)
    at NotFoundBoundary (not-found-boundary.js:84:11)
    at LoadingBoundary (layout-router.js:327:11)
    at ErrorBoundary (error-boundary.js:167:11)
    at InnerScrollAndFocusHandler (layout-router.js:139:9)
    at ScrollAndFocusHandler (layout-router.js:214:11)
    at RenderFromTemplateContext (render-from-template-context.js:16:44)
    at OuterLayoutRouter (layout-router.js:348:11)
    at _ (index.mjs:54:24)
    at J (index.mjs:47:47)
    at ThemeProvider (theme-provider.tsx:7:2)
    at body (<anonymous>)
    at html (<anonymous>)
    at RootLayout [Server] (<anonymous>)

Browsers

Chrome

@mplemay mplemay added the bug Something isn't working label Dec 21, 2024
@mplemay mplemay changed the title diffToSuggestion - encountered two children with the same key diffToSuggestion - two children with the same key Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin:suggestion
Projects
None yet
Development

No branches or pull requests

2 participants