github urql-graphql/urql @urql/svelte@0.3.0

3 years ago

Minor Changes

  • Refactor all operations to allow for more use-cases which preserve state and allow all modes of Svelte to be applied to urql.
    // Standard Usage:
    mutate({ query, variables })()
    // Subscribable Usage:
    $: result = mutate({ query, variables });
    // Curried Usage
    const executeMutation = mutate({ query, variables });
    const onClick = () => executeMutation();
    // Curried Usage with overrides
    const executeMutation = mutate({ query });
    const onClick = () => await executeMutation({ variables });
    // Subscribable Usage (as before):
    $: result = query({ query: TestQuery, variables });
    // Subscribable Usage which preserves state over time:
    const testQuery = query({ query: TestQuery });
    // - this preserves the state even when the variables change!
    $: result = testQuery({ variables });
    // Promise-based callback usage:
    const testQuery = query({ query: TestQuery });
    const doQuery = async () => await testQuery;
    // Promise-based usage updates the subscribables!
    const testQuery = query({ query: TestQuery });
    const doQuery = async () => await testQuery;
    // - doQuery will also update this result
    $: result = query({ query: TestQuery, variables });
    

Patch Changes

  • Updated dependencies (See #860 and #861)
    • @urql/core@1.12.1

Don't miss a new urql release

NewReleases is sending notifications on new releases.