How to use the @graffy/common.add function in @graffy/common

To help you get started, we’ve selected a few @graffy/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github usegraffy / graffy / src / fill / subscribe.js View on Github external
async function resubscribe(unknown, _extraneous) {
    try {
      const changed = add(query, unknown);
      // console.log('Resubscribe');
      if (!changed) return;

      if (upstream) upstream.return(); // Close the existing stream.
      upstream = store.call('watch', query, { skipFill: true });

      let { value } = await upstream.next();
      // console.log('Got first subscription value', value && debug(value));

      if (typeof value === 'undefined') {
        // The upstream is a change subscription, not a live query,
        // so we need to fetch the initial value.

        // TODO: Get a version corresponding to the subscription's start
        // and verify that the store.read response is newer.