tauri-plugin-graphql
tauri-plugin-graphql copied to clipboard
[question] How are things like tauri's `AppHandle` / `Window` being passed to async_graphql's Context
Note: I would have made this a discussion but it seems like they're not enabled for this repo
I'm using this plugin (still works great btw), but am curious how something like ctx.data::<AppHandle>()
is working? ctx
is from async_graphql, and AppHandle
is something from tauri.
I've been searching through the source code of this plugin, hoping to find an obvious place where you're saying "add tauri's app handle to async_graphql's context", but the only reference to it is in an example in a comment. So, it seems very magical at the moment.
Of course, after posting this I noticed this, which probably answers my question:
https://github.com/JonasKruckenberg/tauri-plugin-graphql/blob/78b092deda2e8621a2291c480372d7b3e814b735/src/lib.rs#L246
Now I'm wondering why .inner
is needed in subscriptions
https://github.com/JonasKruckenberg/tauri-plugin-graphql/blob/78b092deda2e8621a2291c480372d7b3e814b735/src/lib.rs#L258