Skip to content

Implement cloud sync #2

@Garciat

Description

@Garciat

Goals

  • Maintain decoupling between the core data model & flow and the cloud sync stack.
    • For example, it is possible to implement everything with Firebase because it is reactive and offline-capable. That means business logic and UI components could directly use Firebase object streams.
    • But I don't want the app to be tied to Firebase in a way that restricts or complicates moving to a different provider.
    • Also, not every user wants cloud sync. By default, the app should only sync to local storage.
  • Model all entities (presets, history records, config?) uniformly.
    • Currently, presets are stored in LocalStorage and history records in IndexedDB. So we have essentially two different storage layers. It would be good to have just one.

Ideas

  • Implement a meta-hook that wraps IDB and provides:
    • Input:
      • A concrete subtype of IDB's DBSchema
    • StoreProvider
      • A context provider that wraps the app and enables the actual hooks.
    • useStoreQuery
      • Returns a reactive query (TODO: read react-query)
    • useStoreRecord
      • Returns a reactive record by key
    • useStoreDelete
      • Returns a delete function for records by key
    • useStoreUpdate
      • Returns an update function for records by key
    • useStoreEvents
      • Returns a sort of stream of store change events. Used by sync providers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions