-
Notifications
You must be signed in to change notification settings - Fork 104
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
"Error: missing 'id' property for item" on RXDB object with inherited id property #471
Comments
Nice catch. Would you like to create a PR?
…On Mon, Aug 14, 2023 at 12:09 PM Bobby Wang ***@***.***> wrote:
The error is:
action.js:70 Uncaught (in promise) Error: missing 'id' property for item {
"id": "99f310e6-bc82-44df-b3d5-26e80dc3cfd5",
"title": "add ability to delete",
"today": false,
"important": false,
"urgent": false,
"createdAt": "2023-08-12T20:04:49.692Z",
"updatedAt": "2023-08-12T20:04:49.692Z",
"completedAt": "2023-08-13T09:33:04.742Z"
}
at validateOptions (action.js:70:15)
at update (action.js:33:13)
at Object.update [as p] (ItemsList.svelte?t=1691977992627:204:107)
at update (scheduler.js:119:30)
at flush (scheduler.js:79:5)
Looking at action.js, it seems to be using .hasOwnProperty to determine
if the id property exists.
const itemWithMissingId = items.find(item => !{}.hasOwnProperty.call(item, ITEM_ID_KEY));
if (itemWithMissingId) {
throw new Error(`missing '${ITEM_ID_KEY}' property for item ${toString(itemWithMissingId)}`);
}
Looking at the doc
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty>
for hasOwnProperty, it seems to only return true for its own property,
but not inherited ones.
I tried myRxdbObj.hasOwnProperty('id') and it returns false - could be
because it's inherited. But myRxdbObj.id does in fact exist.
Would the id have to be its own property as opposed to inherited? I tried 'id'
in myRxdbObj and it returns true.
—
Reply to this email directly, view it on GitHub
<#471>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4OZC6QT6RC5IPCOHB5CVLXVGCEXANCNFSM6AAAAAA3PBX6WM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hmm, looks like even with this line fixed, I'm still getting another error in the finalize handler after dragging.
Not sure why this is happening. 🤔 The finalize handler is pretty straightforward:
|
hi, sorry for the delay. i figured it has something to do with the shape of your item objects. did u have a chance to investigate further? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
I'm getting this error when the
items
inuse:dndzone
is an array of RXDB objects rather than POJO.The error is:
Looking at
action.js
, it seems to be using.hasOwnProperty
to determine if the id property exists.Looking at the doc for
hasOwnProperty
, it seems to only return true for its own property, but not inherited ones.I tried
myRxdbObj.hasOwnProperty('id')
and it returnsfalse
- could be because it's inherited. ButmyRxdbObj.id
does in fact exist.Would the id have to be its own property as opposed to inherited? I tried
'id' in myRxdbObj
(for both inherited and own) and it returnstrue
.The text was updated successfully, but these errors were encountered: