urql-graphql / urql-devtools-exchange

The exchange for usage with Urql Devtools
https://www.npmjs.com/package/@urql/devtools
MIT License
54 stars 6 forks source link

Remove React dependency #25

Closed JoviDeCroock closed 4 years ago

JoviDeCroock commented 4 years ago

We are looking at React internals to derive the displayName we could defer this to the integration specific implementation and make this a dev-only thing.

andyrichardson commented 4 years ago

Brownie points if we can somehow infer the calling components displayName in Preact also

JoviDeCroock commented 4 years ago
import { options } from 'preact';

v?: Vnode;
if (!isProd) options.vnode = (v) => { currentVNode = v }

const hook = () => dispatch({ context: { currentComponent: v&&v.name })
andyrichardson commented 4 years ago

Fixed in #28