mateusz.kwiecinski
12/14/2021, 8:44 PMApolloStore#writeAndPublish which required query and query data only. 3.x exposes ApolloStore#writeOperation but in my scenario it also requires passing customScalarAdapters: CustomScalarAdapters (to properly handle passed data object)
Is there any way to access customScalarAdapters set previously on ApolloClient instance?mateusz.kwiecinski
12/14/2021, 8:44 PMApolloClient is configured using addCustomScalarAdapter so I never have reference to CustomScalarAdapters instance. AFAICS the only way to properly use the writeOperation is to manually build CustomScalarAdapters, save it and pass it via ApolloClient.Builder#customScalarAdapters.
I chcecked I can’t access ApolloClient#customScalarAdapters because it’s private, I can’t access ApolloClient.executionContext[CustomScalarAdapters] because it’s not part of the context 👀mateusz.kwiecinski
12/14/2021, 8:46 PMmbonnin
12/14/2021, 8:47 PMcustomScalarAdapters ahead of time and then keep a reference to thatmbonnin
12/14/2021, 8:48 PMmbonnin
12/14/2021, 8:50 PMApolloClient.customScalarAdapters publicmbonnin
12/14/2021, 8:50 PMmbonnin
12/14/2021, 8:50 PMmbonnin
12/14/2021, 8:51 PMprivate or internal because it's always easier to add rather than remove but in this specific case, I think it's pretty valid to have it publicmateusz.kwiecinski
12/14/2021, 8:59 PMEmpty as the default argument 👀
I’ll browse through the code for a while (I’m still catching up with all the changes 3.x introduces) and if I can’t think of anything reasonable I’ll raise a PR to make the field public 🙂mbonnin
12/14/2021, 9:07 PMApolloStore doesn't know much about ApolloClient and I kind of like that they are decoupledmbonnin
12/14/2021, 9:08 PMcustomScalarAdapters once during ApolloStore construction (and remove the parameter in all calls) but it's pretty late to make such a big API change (stable ships tomorrow 😅 )mateusz.kwiecinski
12/14/2021, 9:19 PMApolloStore so yeah for sure it wouldn’t be worth making any significant api changes right now 🙂 The thing I stumbled upon seems to be fairly easy to work around, so 🤷
Alternatively, instead of making a PR to expose the field publicly I can file an issue which you can discuss internally how you’d like to handle it 🙂mbonnin
12/14/2021, 9:26 PMmbonnin
12/15/2021, 9:30 AMmateusz.kwiecinski
12/15/2021, 9:31 AMmbonnin
12/15/2021, 9:34 AMmbonnin
12/15/2021, 9:34 AM