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: replacePrefix converts the modified property to an object during sync #2113

Closed
onuradsay opened this issue Jan 7, 2025 · 1 comment

Comments

@onuradsay
Copy link

When using the replacePrefix function from dexie to modify tree structure paths, the transformation works correctly in offline mode but fails after syncing with the server. Instead of executing the string replacement, the server returns a serialized version of the operation, breaking the application's tree structure.

db.treeNodes
  .where('parentPath')
  .startsWith(`${node.parentPath}${node.id}/`)
  .modify({
    parentPath: replacePrefix(node.parentPath, newParentPath)
  });
  • When offline: This operation works as expected, properly modifying the parentPath strings
  • After sync: The server returns an object instead of the transformed string:
{
  "parentPath": {
    "replacePrefix": ["old_prefix", "new_prefix"]
  }
}

This breaks the application as it expects parentPath to be a string, not an object.

@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

2 participants