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

Update Broke - Weird Behaviour #177

Open
GaddMaster opened this issue Jan 20, 2022 · 1 comment
Open

Update Broke - Weird Behaviour #177

GaddMaster opened this issue Jan 20, 2022 · 1 comment

Comments

@GaddMaster
Copy link

Hi

Struggling with this weird behaviour

It's simply understand my situation by reading the few lines of code and the few lines of console logs.

How is this happening, what on Earth am I missing here.

            console.log("Trying");
            console.log({ index });
            console.log(account.access);
            console.log(account.access[index]);
            const _access = updateHelper(account.access, {
                [0]: {
                    status: {
                        $set: "three"
                    }
                }
            });
            console.log({ _access });
Trying
{ index: 0 }
[{"userDBID":"61e92c4d82661c026e8c7fcd","type":"owner","status":"pending","position":"Managing Director"}]
{
  userDBID: '61e92c4d82661c026e8c7fcd',
  type: 'owner',
  status: 'pending',
  position: 'Managing Director'
}
error - TypeError: Class constructor CoreMongooseArray cannot be invoked without 'new'
    at copy (/Users/gaddbox/Documents/rentdodo/node_modules/immutability-helper/index.js:41:25)
    at /Users/gaddbox/Documents/rentdodo/node_modules/immutability-helper/index.js:104:38
    at Array.forEach (<anonymous>)
    at Context.update (/Users/gaddbox/Documents/rentdodo/node_modules/immutability-helper/index.js:85:26)
    at onAgencyVerified (webpack-internal:///./utils/server/contact.js:717:82)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async onVerifyCheckup (webpack-internal:///./utils/server/contact.js:557:34)
    at async handler (webpack-internal:///./pages/api/account/update/address.js:38:5)
    at async Object.apiResolver (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/api-utils.js:101:9)
    at async DevServer.handleApiRequest (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/next-server.js:770:9)
    at async Object.fn (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/next-server.js:661:37)
    at async Router.execute (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/router.js:205:32)
    at async DevServer.run (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/next-server.js:841:29)
    at async DevServer.run (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/dev/next-dev-server.js:355:20)
    at async DevServer.handleRequest (/Users/gaddbox/Documents/rentdodo/node_modules/next/dist/server/next-server.js:292:20) {
  page: '/api/account/update/address'
}

Daniel

@GaddMaster
Copy link
Author

Tell me I am not going crazy ?

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

1 participant