Skip to content

(persisted) - Add generateHash option to the persistedFetchExchange#870

Merged
kitten merged 5 commits intourql-graphql:masterfrom
lorenries:custom-hash
Jun 18, 2020
Merged

(persisted) - Add generateHash option to the persistedFetchExchange#870
kitten merged 5 commits intourql-graphql:masterfrom
lorenries:custom-hash

Conversation

@lorenries
Copy link
Copy Markdown
Contributor

Summary

This PR adds support for a custom hash function in the persisted query exchange. This is useful for non-browser environments like react-native, where you might want to use a different crypto API (like Expo's, for instance).

Usage:

import sha256 from "my-library";

const client = createClient({
  url: 'http://localhost:1234/graphql',
  exchanges: [
    dedupExchange,
    cacheExchange,
    persistedFetchExchange({ generateHash: sha256 }),
    fetchExchange
  ],
});

Set of changes

Adds an argument to the persistedFetchExchange factory. No breaking changes.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 17, 2020

🦋 Changeset is good to go

Latest commit: 861cc51

We got this.

This PR includes changesets to release 1 package
Name Type
@urql/exchange-persisted-fetch Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Collaborator

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great already, do you mind adding a changeset by doing yarn changeset at the root and indicating this as a minor version bump

Copy link
Copy Markdown
Member

@kitten kitten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up! We really haven’t had time to look into React Native support and different avenues, but seeing how simple this addition is it just makes more sense 👍

Comment thread .changeset/green-lies-help.md Outdated
@kitten kitten changed the title Adds support for a custom hash function in @urql/exchange-persisted-fetch (persisted) - Add generateHash option to the persistedFetchExchange Jun 18, 2020
@kitten kitten merged commit f80c96d into urql-graphql:master Jun 18, 2020
@kitten
Copy link
Copy Markdown
Member

kitten commented Jun 30, 2020

Thanks again! This has now been published as 1.1.0 https://github.com/FormidableLabs/urql/blob/main/exchanges/persisted-fetch/CHANGELOG.md#110

@lorenries
Copy link
Copy Markdown
Contributor Author

Cool! Thank you both ❤️

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants