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

TypeError: targetChild.set is not a function #407

Open
pruge opened this issue Dec 16, 2024 · 2 comments
Open

TypeError: targetChild.set is not a function #407

pruge opened this issue Dec 16, 2024 · 2 comments

Comments

@pruge
Copy link

pruge commented Dec 16, 2024

Hi

When I update block$, the error occurs.
However, if I update except transform, there will be no error.

How should I modify transform?

I have the following state:
3.0.0-beta.19

export const block$ = observable(
  syncedCrud({
    list: listModel<Block>({
      model: 'block',
      where: () => ({ hmiProjectId: hmiProjectStore$.projectId.get() }),
    }),
    create: createModel<Block>({
      model: 'block',
      relation: () => ({ hmiProject: { connect: { id: hmiProjectStore$.projectId.get() } } }),
    }),
    update: updateModel<Block>({ model: 'block' }),
    delete: deleteModel<Block>({ model: 'block' }),

    updatePartial: true,
    as: 'object',
    mode: 'assign',

    transform: {
      load: async (value: Block): Promise<BlockLocal> => {
        const blockLocal = { ...value, node: null } as BlockLocal
        blockLocal.node = parse(value.component, options)
        return blockLocal
      },
      save: async (value: BlockLocal): Promise<Block> => {
        delete value.node
        delete value.hmiProjectId
        console.log('save', value)
        return value
      },
    },
)
// update position
block$[id].set((prev) => ({ ...prev, ...position }))
app-index.js:33 
Forcibly completing observableBatcher because end() was never called. 
This may be due to an uncaught error between begin() and end().

index.mjs:461 
Uncaught (in promise) TypeError: targetChild.set is not a function
    at _mergeIntoObservable (index.mjs:461:25)
    at _mergeIntoObservable (index.mjs:463:11)
    at _mergeIntoObservable (index.mjs:463:11)
    at mergeIntoObservable (index.mjs:432:5)
    at eval (sync.mjs:737:104)
    at onChangeRemote2 (sync.mjs:269:3)
    at doChangeRemote (sync.mjs:737:13)
@pruge
Copy link
Author

pruge commented Dec 16, 2024

The problem does not occur in version 3.0.0-beta.15.

@jmeistrich
Copy link
Contributor

Hi @pruge, is it possible to create a minimal repro that I could test? I'm not sure how to reproduce the error you're seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants