Skip to content

Dexie Cloud: replacePrefix converts the modified property to an object during sync #2113

@onuradsay

Description

@onuradsay

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Released

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions