Panics · P36 Account: handlers in new; gone accounts, workspaces, providers and roles mark none; expiries refuse overflow

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 05:59:27 -04:00
1 parent ad472490e0
commit e7aec1651e
19 files changed
+476 -518

No files matched your search

+7 -11
View File
@@ -40,18 +40,21 @@ pub struct SignupForm {
terms: Option<SharedString>,
error: Option<SharedString>,
busy: bool,
on_submit: Option<OnSignup>,
on_submit: OnSignup,
on_sign_in: Option<Run>,
}
impl SignupForm {
pub fn new(id: impl Into<ElementId>) -> Self {
pub fn new(
id: impl Into<ElementId>,
on_submit: impl Fn(&Signup, &mut Window, &mut App) + 'static,
) -> Self {
Self {
id: id.into(),
terms: None,
error: None,
busy: false,
on_submit: None,
on_submit: Rc::new(on_submit),
on_sign_in: None,
}
}
@@ -74,11 +77,6 @@ impl SignupForm {
self
}
pub fn on_submit(mut self, handler: impl Fn(&Signup, &mut Window, &mut App) + 'static) -> Self {
self.on_submit = Some(Rc::new(handler));
self
}
/// Shows "Have an account? Sign in".
pub fn on_sign_in(mut self, handler: impl Fn(&mut Window, &mut App) + 'static) -> Self {
self.on_sign_in = Some(Rc::new(handler));
@@ -105,9 +103,7 @@ impl RenderOnce for SignupForm {
&& rules.iter().all(|(_, kept)| *kept)
&& (self.terms.is_none() || agreed)
&& !self.busy;
let on_submit = self
.on_submit
.unwrap_or_else(|| panic!("sign-up form {id:?} has no on_submit"));
let on_submit = self.on_submit;
let submit: Run = Rc::new(move |window, cx| {
log::info!("sign-up form: create account");
on_submit(&signup, window, cx);