add TanStack Query query + mutation output targets#205
Open
swalker326 wants to merge 3 commits intospecta-rs:mainfrom
Open
add TanStack Query query + mutation output targets#205swalker326 wants to merge 3 commits intospecta-rs:mainfrom
swalker326 wants to merge 3 commits intospecta-rs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CommandOutputTargetenum andBuilder::command_output_target(...)config so command generation can target either invoke functions (default) or TanStack Query helpersCommandOutputTarget::TanstackQueryis selected, generatecommands.*wrappers that returnqueryOptions({ queryKey, queryFn })using@tanstack/react-query, with query keys including command name and argument object when presentBuilder::mutation_commands([...]); commands in this set generatemutationOptions({ mutationKey, mutationFn })while non-listed commands continue generatingqueryOptionsexamples/react-query-appthat uses generated query and mutation helpers from ReactHow to test (new example app)
pnpm installcargo run --manifest-path examples/react-query-app/src-tauri/Cargo.toml(generatesexamples/react-query-app/src/bindings.ts)pnpm --dir examples/react-query-app tauri devNotes
queryOptionsAPI #147 and follows its proposedqueryOptionsshape as the starting pointcargo test --all --all-featuresstill has unrelated example/plugin formatter API failures in this repo; validation used here:cargo check -p tauri-specta --all-features --libcargo check -p tauri-specta-example-react-query-apppnpm --dir examples/react-query-app exec tsc --noEmitpnpm --dir examples/react-query-app build