Skip to content

createRemotePersister: ability to throttle/debounce autoSave #107

Description

@rob-gordon

Is your feature request related to a problem? Please describe.
It would be really helpful if the remote persister allowed throttling or debouncing the rate at which it saves.

Describe the solution you'd like
It could either be an argument to createRemotePersister the same way autoLoadIntervalSeconds works, or for people who want more control it could be a function of the save function, so that people could do something like:

 createRemotePersister(store, "/api/load", "/api/save", 5, (save) => debounce(save, 2000))

Describe alternatives you've considered
If my remote persister is a node server then I can just throttle/debounce database writes on the server side, but ideally it would be great if this could work with serverless functions which don't run continuously. In that case I can only see it working if it's throttled on the client-side.

Additional context
Thank you for this awesome library!

Metadata

Metadata

Assignees

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