-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Description:
When adding an object to a list managed by syncedStore, if the object contains an array property that includes undefined as a value (e.g., [undefined]), an error is raised:
Uncaught TypeError: c is undefined
This issue seems to originate from internal assumptions that all array values are either null or valid serializable types, and fails to gracefully handle undefined entries.
🔁 Steps to Reproduce:
- Create a synced store.
- Push an object into a synced array where one of the properties is
[undefined].
💥 Reproduction Example:
import { syncedStore, getYjsDoc } from '@syncedstore/core';
const store = syncedStore({ items: [] });
store.items.push({
name: 'test',
data: [undefined], // this causes the error
});🧪 Expected Behavior:
The object should be added to the list without error, or at minimum undefined values should be gracefully converted (e.g., to null)
🐛 Actual Behavior:
Throws:
Uncaught TypeError: c is undefined
TypeError: c is undefined
typeListInsertGenericsAfter webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5539
typeListInsertGenericsAfter webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5535
typeListInsertGenerics webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5591
insert webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5981
transact webpack-internal:///./node_modules/yjs/dist/yjs.mjs:3525
insert webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5980
_integrate webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5920
integrate webpack-internal:///./node_modules/yjs/dist/yjs.mjs:9606
integrate webpack-internal:///./node_modules/yjs/dist/yjs.mjs:10150
typeMapSet webpack-internal:///./node_modules/yjs/dist/yjs.mjs:5753
set webpack-internal:///./node_modules/yjs/dist/yjs.mjs:6320
transact webpack-internal:///./node_modules/yjs/dist/yjs.mjs:3525
set webpack-internal:///./node_modules/yjs/dist/yjs.mjs:6319
_app.js:327933:25
This makes it difficult to debug and can unexpectedly crash apps that rely on dynamic data using syncedStore.
Metadata
Metadata
Assignees
Labels
No labels