Skip to content

Doc utility method for creating a snapshot #500

Description

@curran

Tracking this idea out of a discussion in #493

As a user of ShareDB in the context of an isomorphic JavaScript app, I want to be able to use ingestSnapshot to ingest data that was transferred to the client externally to the client's ShareDB connection, so that the number of times a given document is queried for in the database and transferred over the wire is reduced from 2 (server side fetch, client side subscribe without ingestSnapshot) to 1 (server side fetch only).

Proposed API: Doc.createSnapshot(). This makes sense to invoke only after a successful fetch or subscribe.

Activity

  1. alecgibson commented on Jul 23, 2021

    @alecgibson
    Collaborator

    Sounds sensible to me. I guess the opposite of "ingest" is "egest", but it doesn't sound like a nice/common word, so "create" is fine by me.

  2. curran commented on Jul 23, 2021

    @curran
    ContributorAuthor
  3. curran commented on Jul 24, 2021

    @curran
    ContributorAuthor

    Closing this because for my use case I can use fetchSnapshot.

  4. curran commented on Aug 22, 2021

    @curran
    ContributorAuthor

    On second thought, it might be quite useful to have a utility method for generating a snapshot from a doc.

    Use case:

    • We have an API where the response should be a valid snapshot, for client side ingestion.
    • If the document already exists, we can use fetchSnapshot,
    • but if the document does not exist, we need to create it and return its snapshot.

    In the case where the document does not exist yet, it would be great to have a method on Doc that could generate a snapshot, rather than first create the doc and then execute fetchSnapshot against it.

  5. reopened this on Aug 22, 2021
  6. added a commit that references this issue on Aug 22, 2021
    e6312f2
  7. curran commented on Aug 24, 2021

    @curran
    ContributorAuthor

    Notes from call: Also useful for offline use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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