Replies: 2 comments 2 replies
-
I think the idea is solid! The only thing I would think about is somehow abstracting the storage. Apollo Client can be used outside of web, for example in react-native or for SSR, so internally tying it to use either localStorage or query string would break those use cases. Extending |
Beta Was this translation helpful? Give feedback.
-
Has there been any progress or update on this front? Also curious about current workarounds for getting Laika to work for queries that run on initial page load. Thanks so much! |
Beta Was this translation helpful? Give feedback.
-
The process for creating an intercept and specifying a mock result is a little tricky to work with if you're trying to mock a query that runs on page load, especially if the Apollo link is being lazily loaded. What if we could specify some intercepts/mock responses that we want in place at the point that we initialize the Apollo link, so they were ready from the outset?
I think I'm envisioning that CreateLaikaLinkOptions could be extended to include an array of intercept + mock definitions, that would be set up immediately.
The downside here is that you don't have a reference to the intercept anywhere to call further methods on it, but I think those are mostly helpful in testing situations, and I envision this being used for simulating server responses in an actual running app. Maybe there'd be a way to expose the intercepts via the main toolkit somehow so that you could still manipulate them?
Beta Was this translation helpful? Give feedback.
All reactions