Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] How are things like tauri's AppHandle / Window being passed to async_graphql's Context #136

Open
mikew opened this issue Sep 14, 2023 · 1 comment

Comments

@mikew
Copy link

mikew commented Sep 14, 2023

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.

@mikew
Copy link
Author

mikew commented Sep 14, 2023

Of course, after posting this I noticed this, which probably answers my question:

.execute_batch(req.data(window.app_handle()).data(window))

Now I'm wondering why .inner is needed in subscriptions

let mut stream = schema.execute_stream(req.inner.data(window.app_handle()).data(window));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant