/// The query segment is anything that implements <https://docs.rs/dioxus-router/latest/dioxus_router/routable/trait.FromQuery.html>. You can implement that trait for a struct if you want to parse multiple query parameters.
-impl FromQuery for BlogQuerySegments {
+impl FromQuery for ManualBlogQuerySegments {
fn from_query(query: &str) -> Self {
let mut name = None;
let mut surname = None;
@@ -57,13 +63,21 @@ impl FromQuery for BlogQuerySegments {
}
#[component]
-fn BlogPost(cx: Scope, query_params: BlogQuerySegments) -> Element {
+fn BlogPost(cx: Scope, query_params: ManualBlogQuerySegments) -> Element {
render! {
div{"This is your blogpost with a query segment:"}
div{format!("{:?}", query_params)}
}
}
+#[component]
+fn AutomaticBlogPost(cx: Scope, name: String, surname: String) -> Element {
+ render! {
+ div{"This is your blogpost with a query segment:"}
- panic!("Failed to bundle project: {}\nMake sure you have automation enabled in your terminal (https://github.com/tauri-apps/tauri/issues/3055#issuecomment-1624389208) and full disk access enabled for your terminal (https://github.com/tauri-apps/tauri/issues/3055#issuecomment-1624389208)", err);
+ panic!("Failed to bundle project: {:#?}\nMake sure you have automation enabled in your terminal (https://github.com/tauri-apps/tauri/issues/3055#issuecomment-1624389208) and full disk access enabled for your terminal (https://github.com/tauri-apps/tauri/issues/3055#issuecomment-1624389208)", err);
- /// The index HTML file to drive the bundling process [default: index.html]
- #[arg(long)]
- pub target: Option<PathBuf>,
-
/// Build in release mode [default: false]
#[clap(long)]
#[serde(default)]
pub release: bool,
+ /// This flag only applies to fullstack builds. By default fullstack builds will run with something in between debug and release mode. This flag will force the build to run in debug mode. [default: false]
+ #[clap(long)]
+ #[serde(default)]
+ pub force_debug: bool,
+
// Use verbose output [default: false]
#[clap(long)]
#[serde(default)]
@@ -32,17 +32,53 @@ pub struct ConfigOptsBuild {
#[clap(long, value_enum)]
pub platform: Option<Platform>,
+ /// Skip collecting assets from dependencies [default: false]
+ #[clap(long)]
+ #[serde(default)]
+ pub skip_assets: bool,
+
/// Space separated list of features to activate
#[clap(long)]
pub features: Option<Vec<String>>,
+
+ /// The feature to use for the client in a fullstack app [default: "web"]
- /// The index HTML file to drive the bundling process [default: index.html]
- #[arg(short, long)]
- pub target: Option<PathBuf>,
-
/// Port of dev server
#[clap(long)]
#[clap(default_value_t = 8080)]
@@ -62,6 +98,11 @@ pub struct ConfigOptsServe {
#[serde(default)]
pub release: bool,
+ /// This flag only applies to fullstack builds. By default fullstack builds will run with something in between debug and release mode. This flag will force the build to run in debug mode. [default: false]
+ #[clap(long)]
+ #[serde(default)]
+ pub force_debug: bool,
+
// Use verbose output [default: false]
#[clap(long)]
#[serde(default)]
@@ -71,7 +112,7 @@ pub struct ConfigOptsServe {
#[clap(long)]
pub profile: Option<String>,
- /// Build platform: support Web & Desktop [default: "default_platform"]
+ /// Build platform: support Web, Desktop, and Fullstack [default: "default_platform"]
- if err.kind() != std::io::ErrorKind::WouldBlock {
+ let error_string = err.to_string();
+ // Filter out any error messages about a operation that may block and an error message that triggers on some operating systems that says "Waiting for a process to open the other end of the pipe" without WouldBlock being set
+ let display_error = err.kind() != std::io::ErrorKind::WouldBlock
+ && !error_string.contains("Waiting for a process");
+ if display_error {
println!("Error connecting to hot reloading: {} (Hot reloading is a feature of the dioxus-cli. If you are not using the CLI, this error can be ignored)", err);
return Err(Error::new_spanned(field_name, "Naming a prop `key` is not allowed because the name can conflict with the built in key attribute. See https://dioxuslabs.com/learn/0.4/reference/dynamic_rendering#rendering-lists for more information about keys"));
@@ -717,6 +949,12 @@ Finally, call `.build()` to create the instance of `{name}`.
});
let reconstructing = self.included_fields().map(|f| f.name);
+ let FieldInfo {
+ name: field_name,
+ ty: field_type,
+ ..
+ } = field;
+ // Add the bump lifetime to the generics
let mut ty_generics: Vec<syn::GenericArgument> = self
.generics
.params
@@ -800,6 +1038,16 @@ Finally, call `.build()` to create the instance of `{name}`.
);
let repeated_fields_error_message = format!("Repeated field {field_name}");
+ let forward_extended_fields = self.extend_fields().map(|f| {
+ let name = f.name;
+ quote!(#name: self.#name)
+ });
+ let forward_bump = if self.extend_fields().next().is_some() {
+ let children = ErrorBoundaryPropsBuilder_Optional::into_value(children, || {
+ ::core::default::Default::default()
+ });
+ let handle_error = ErrorBoundaryPropsBuilder_Optional::into_value(handle_error, || {
+ ErrorHandler(Box::new(default_handler))
+ });
+ ErrorBoundaryProps {
+ children,
+ handle_error,
+ }
+ }
+}
+/// Create a new error boundary component.
+///
+/// ## Details
+///
+/// Error boundaries handle errors within a specific part of your application. Any errors passed in a child with [`Throw`] will be caught by the nearest error boundary.
+///
+/// ## Example
+///
+/// ```rust, ignore
+/// rsx!{
+/// ErrorBoundary {
+/// handle_error: |error| rsx! { "Oops, we encountered an error. Please report {error} to the developer of this application" }
+/// ThrowsError {}
+/// }
+/// }
+/// ```
+///
+/// ## Usage
+///
+/// Error boundaries are an easy way to handle errors in your application.
+/// They are similar to `try/catch` in JavaScript, but they only catch errors in the tree below them.
+/// Error boundaries are quick to implement, but it can be useful to individually handle errors in your components to provide a better user experience when you know that an error is likely to occur.
+#[allow(non_upper_case_globals, non_snake_case)]
+pub fn ErrorBoundary<'a>(cx: Scope<'a, ErrorBoundaryProps<'a>>) -> Element {
/// This is useful for inserting or removing contexts from a scope, or rendering out its root node
@@ -98,7 +108,7 @@ impl Runtime {
}
}
-/// A gaurd for a new runtime. This must be used to override the current runtime when importing components from a dynamic library that has it's own runtime.
+/// A guard for a new runtime. This must be used to override the current runtime when importing components from a dynamic library that has it's own runtime.
///
/// ```rust
/// use dioxus::prelude::*;
@@ -123,6 +133,7 @@ impl Runtime {
/// }
/// }
///
+/// # #[allow(non_snake_case)]
/// fn Component(cx: Scope<ComponentProps>) -> Element {