How to use the wonka.take function in wonka

To help you get started, we’ve selected a few wonka 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 FormidableLabs / urql / src / client.ts View on Github external
executeRequestOperation(operation: Operation): Source {
    const { key, operationName } = operation;
    const operationResults$ = pipe(
      this.results$,
      filter(res => res.operation.key === key)
    );

    if (operationName === 'mutation') {
      // A mutation is always limited to just a single result and is never shared
      return pipe(
        operationResults$,
        onStart(() => this.dispatchOperation(operation)),
        take(1)
      );
    }

    const teardown$ = pipe(
      this.operations$,
      filter(op => op.operationName === 'teardown' && op.key === key)
    );

    const result$ = pipe(
      operationResults$,
      takeUntil(teardown$),
      onStart(() => this.onOperationStart(operation)),
      onEnd(() => this.onOperationEnd(operation))
    );

    return operation.context.suspense !== false &&
github carlos-kelly / publications / src / contexts / documents-provider.tsx View on Github external
async (id: string) => {
      try {
        const { data } = await pipe(
          props.client.executeQuery({
            query: gql(documentQuery),
            variables: { id },
            key: 0,
          }),
          take(1),
          toPromise
        );
        flowRight(
          setCurrentDocument,
          addEditorStateToDocument
        )(data.document);
      } catch (e) {
        console.error(e);
      }
      return;
    },
    [props.client]