Skip to content

Commit 628932d

Browse files
refactor(dioxus): use unreachable for actions without server feature (#159)
1 parent 52c965a commit 628932d

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

  • packages/integrations/shield-dioxus/src/routes

packages/integrations/shield-dioxus/src/routes/action.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub fn Action(props: ActionProps) -> Element {
2828

2929
// TODO: Figure out a way to access `FromContext` and `extract` without `dioxus/server` feature.
3030

31+
#[cfg_attr(not(feature = "server"), allow(unused_variables))]
3132
#[server]
3233
async fn forms(action_id: String) -> Result<ActionForms, ServerFnError> {
3334
#[cfg(feature = "server")]
@@ -46,13 +47,7 @@ async fn forms(action_id: String) -> Result<ActionForms, ServerFnError> {
4647
}
4748

4849
#[cfg(not(feature = "server"))]
49-
{
50-
Ok(ActionForms {
51-
id: action_id.clone(),
52-
name: action_id,
53-
forms: vec![],
54-
})
55-
}
50+
unreachable!()
5651
}
5752

5853
#[cfg_attr(not(feature = "server"), allow(unused_variables))]
@@ -87,7 +82,10 @@ pub async fn call(
8782
},
8883
)
8984
.await?;
85+
86+
Ok(())
9087
}
9188

92-
Ok(())
89+
#[cfg(not(feature = "server"))]
90+
unreachable!()
9391
}

0 commit comments

Comments
 (0)