Skip to content

Bug in update/delete functions with localStorageCollection #397

@pwalczyszyn

Description

@pwalczyszyn

When calling update or delete functions on local storage collection it always applies to last item in the collection (not the one with provided id).

This is how I configure the collection:

export const measurementsCollection = createCollection(
  localStorageCollectionOptions({
    id: "measurements",
    storageKey: "app-measurements",
    getKey: (item) => item.id,
    schema: $Measurement,
  })
);

This is how I call update/delete fns:

// update example
measurementsCollection.update(measurementId, draft => {
  draft.sync = true
})

// delete example
measurementsCollection.update(measurementId)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions