Skip to content

[docs] Lack of examples makes for confusing times #3255

@JamesYeoman

Description

@JamesYeoman

I just want to create a file dialog within an async tauri command, but the File Dialog Builder is designed with callbacks. As someone who's not a rust god, I don't know the ins and outs of rust, so I'm still wary of making sure I'm appeasing the borrow checker god.

  • Do I need to explicitly borrow the state object from the command in the callback?
  • Is there a way to update state from within a command?
  • Does the command function need to wait for the callback to complete before exiting (given that the dialog function calls std::thread::spawn)

I really like Tauri, but the examples that are provided are very barebones. I'm trying to use Tauri in a personal project, but every time I finish the frontend work for a feature, I have to spend ages battling to figure out how to do what I want in Tauri. Like for example: what's the purpose of stateObj.0 in all the cases where there's tauri managed state in the state example? Why does the commands example use state.inner() when the documentation for that method states that it's typically unnecessary? And where's the state.0 that the state example implied was required?

Here's what I'm currently struggling with
image

Is there any chance of the examples being updated, improved, and api usage being better explained? Or at the very least, is there any chance of a list of existing tauri-based projects being made so that people can refer to those to see how the api is used?

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions