You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling editor.tf.setValue() with a value which has table cells containing custom elements the custom elements are not rendered - only one element within a cell is rendered.
This is demonstrated in the repro link provided.
The use case is simply instantiating the editor with an empty value, loading data from the server and using tf.setValue to display the value fetched from the server.
Example
Using the following value, when it is provided as an initial value for the editor, you will see rendered the "ref" element with text "im a custom element, nested within a table, and will vanish after later editor.tf.setValue updates" however if you then call edtor.tf.setValue([mockTableValue]) you will see the table rendered but without that element rendered or text visible.
const mockTableValue = {
children: [
{
children: [
{
children: [
{
children: [
{
text: 'Rule',
},
],
type: 'p',
},
],
type: 'th',
},
],
type: 'tr',
},
{
children: [
{
children: [
{
children: [
{
text: 'Some text in a paragraph. ',
},
],
type: 'p',
},
{
type: 'ref',
identifier: 'reference_1',
label: 'reference_1',
children: [
{
text: 'im a custom element, nested within a table, and will vanish after later editor.tf.setValue updates',
},
],
url: '',
title: 'test title',
},
],
type: 'td',
},
],
type: 'tr',
},
],
type: 'table',
};
1. Load preview https://4wf96c-3000.csb.app/editor
2. Note how the blue custom element will disappear after 1000ms when a `tf.setValue(clonedInitialValue)` is called to demonstrate the issue
Plate version
v43 as per latest template (but also validated in v41)
Slate React version
0.112.0
Screenshots
initial value:
after using setValue with the exact same initial value:
(note absence of custom element)
Logs
Browsers
Chrome
The text was updated successfully, but these errors were encountered:
chrisui
changed the title
Custom elements nested within table cells are not rendered beyond initial value
[Custom?] elements nested within table cells are not rendered beyond initial value
Feb 10, 2025
Note there is a console error Cannot update a component (ForwardRef) while rendering a different component (ForwardRef). however this is most likely just a coincidental error as I do not get this with my local non-minimal repro (older version plate v41) but still get the same bug behaviour.
Description
Originally posted issue in discord here: https://discord.com/channels/1026227597115396188/1026256206915965078/1336745607993495613
When calling
editor.tf.setValue()
with a value which has table cells containing custom elements the custom elements are not rendered - only one element within a cell is rendered.This is demonstrated in the repro link provided.
The use case is simply instantiating the editor with an empty value, loading data from the server and using
tf.setValue
to display the value fetched from the server.Example
Using the following value, when it is provided as an initial value for the editor, you will see rendered the "ref" element with text "im a custom element, nested within a table, and will vanish after later editor.tf.setValue updates" however if you then call
edtor.tf.setValue([mockTableValue])
you will see the table rendered but without that element rendered or text visible.Reproduction URL
https://codesandbox.io/p/github/chrisui/plate-table-issues-repro/main?import=true
Reproduction steps
1. Load preview https://4wf96c-3000.csb.app/editor 2. Note how the blue custom element will disappear after 1000ms when a `tf.setValue(clonedInitialValue)` is called to demonstrate the issue
Plate version
v43 as per latest template (but also validated in v41)
Slate React version
0.112.0
Screenshots
initial value:
after using setValue with the exact same initial value:
(note absence of custom element)
Logs
Browsers
Chrome
The text was updated successfully, but these errors were encountered: