graphql-playground icon indicating copy to clipboard operation
graphql-playground copied to clipboard

Custom fetcher

Open timsuchanek opened this issue 8 years ago • 6 comments

It should be possible to add a customer fetcher like possible in GraphiQL.

timsuchanek avatar Sep 28 '17 14:09 timsuchanek

According to the doc, this seems possible now

https://github.com/graphcool/graphql-playground#as-react-component

tlvenn avatar Oct 24 '17 04:10 tlvenn

Actually looking at the code, Playground component does not have a fetcher prop so it seems the documentation is incorrect and this still need to be addressed.

I guess once custom fetcher is supported, it will take care of executing subscriptions as well and so it will make how subscriptions are actually handled pluggable at the same time so that it might not be really necessary to introduce Apollo Link as suggested in #195

tlvenn avatar Oct 25 '17 04:10 tlvenn

@timsuchanek can you confirm that your plan for a custom fetcher would be able to handle subscriptions as well ?

tlvenn avatar Oct 28 '17 01:10 tlvenn

@tlvenn sorry for getting back so late.

The custom fetcher would not only be able to, but would have to handle subscriptions.

As you see here, we're checking if it is a subscription. https://github.com/graphcool/graphql-playground/blob/master/packages/graphql-playground-react/src/components/Playground.tsx#L972 The fetcher then needs to return an observable.

For anyone interested in tackling this, the property would need to be passed from MiddlewareApp.tsx to Playground.tsx.

timsuchanek avatar Jan 18 '18 14:01 timsuchanek

Is setting a custom fetcher possible yet?

lastmjs avatar May 20 '21 16:05 lastmjs

Is this solved in https://codesandbox.io/s/mvmoeex1 ?

wmertens avatar Jan 19 '22 15:01 wmertens