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

Dexie cloud add() operator sync bug #2103

Closed
NitroRCr opened this issue Nov 29, 2024 · 2 comments
Closed

Dexie cloud add() operator sync bug #2103

NitroRCr opened this issue Nov 29, 2024 · 2 comments

Comments

@NitroRCr
Copy link

Reproduction

There is a message object in the table messages
Its contents.0.items was initially an empty array

image

Execute this:

await db.messages.update('<messageId>', {
  'contents.0.items': add([item])
})

It works fine. The item has been added.

image

It also triggers sync at the same time, with payload:

image

Bug when receiving the response:

{
    "changes": [
        {
            "table": "messages",
            "muts": [
                {
                    "type": "update",
                    "keys": [
                        "1idrbrtjc4945r8qqo"
                    ],
                    "changeSpecs": [
                        {
                            "contents": [
                                {
                                    "text": "testttttttttttttttttt",
                                    "type": "user-message",
                                    "items": {
                                        "add": [
                                            {
                                                "id": "1idrc693r4945r9p5h",
                                                "type": "quote",
                                                "name": "用户消息引用 (16)",
                                                "contentText": "sttttttttttttttt"
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    ],
                    "txid": "R4ROwJy+lHROKdmK50lbFw=="
                }
            ]
        }
    ],
    "rejections": [],
    // ...
}

The message changed again, and content.0.items became a object with property add:
image
This is not an expected behavior. I guess it is a bug of dexie-cloud

I'm using [email protected] and [email protected]

@onuradsay
Copy link

I think this is the same problem with #2113

@dfahlander dfahlander moved this from Ready to In progress in Dexie & Dexie Cloud Q1-Q2 2025 Jan 7, 2025
dfahlander pushed a commit that referenced this issue Jan 15, 2025
dfahlander added a commit that referenced this issue Jan 15, 2025
* Fix issues #2103 and #2113

* Allow tagging released version as canary

---------

Co-authored-by: David Fahlander <[email protected]>
@dfahlander dfahlander moved this from In progress to Done in Dexie & Dexie Cloud Q1-Q2 2025 Jan 15, 2025
@dfahlander
Copy link
Collaborator

Fixed in latest dexie and dexie-cloud-addon:

[email protected]
[email protected]

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

No branches or pull requests

3 participants