benawad / benawad/jwt-auth-example
Trying to get Apollo 3 compat working - feedback appreciated
- Dominant language
- TypeScript
- Stars
- 463
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
Was experimenting with upgrading this project (nice work btw) to Apollo 3, and noticed there is apparently a change in Apollo 3's `apollo-link` which breaks the current version of `apollo-link-refresh-token` (0.2.7 at the time of writing).
I see `apollo-link-token-refresh` [relies] on Apollo v2's `operation.toKey()`, and since Apollo 3 has dropped this ([version 2], [version 3]) a workaround is needed.
I happened to see `apollo-link`'s test mocks seem to [generate keys based on request] and tried to re-purpose that helper function to fix [things].
Well, I was able to get TypeScript happy again, but I'm not sure if this is actually a good idea.
I'm curious your opinion! What do you think?
I believe the point of the key is that it should be unique - not 100% sure if this actually guarantees that.
[PR] - strictly a WIP
[Fork]
[Docs] on stateful links
[relies]: https://github.com/newsiberian/apollo-link-token-refresh/blob/4abf545e2a70e59235f545776d155310fecfa1e9/src/queuing.ts#L55
[version 2]: https://github.com/apollographql/apollo-link/blob/9a07942b3b8b908c9cdc6863e746ac87284c735b/packages/apollo-link/src/types.ts#L21
[version 3]: https://github.com/apollographql/apollo-client/blob/c14c94b73ada83c92d75271d3a5dc17b03ccb85f/src/link/core/types.ts#L15
[generate keys based on request]:https://github.com/apollographql/apollo-client/blob/0340c48429b20f621d552af748527798bf6f26c5/src/utilities/testing/mocking/mockLink.ts#L29
[things]: https://github.com/newsiberian/apollo-link-token-refresh/pull/17
[PR]: https://github.com/newsiberian/apollo-link-token-refresh/pull/17
[Fork]: https://github.com/onpaws/apollo-link-token-refresh/tree/apollo-3.0
[Docs]: https://github.com/apollographql/apollo-client/blob/master/docs/source/api/link/introduction.md#stateful-links
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.