When RouterLayer.go is called in the onSuccess hook in the materialize theme, it causes the current template to be destroyed. Because of this, the endSubmit hook does not execute. It checks the template before running and does not call the endSubmit hook if the template is destroyed or doesn't exist.
As a result, the Session variable that controls the disabled state of the submit buttons is never reset and the buttons remain disabled on forms.
Several possible solutions. A) don't use a session variable, so the state does not leak to other template instances. B) defer the router action so that the AutoForm hooks can complete before the template is destroyed. C) reset the Session variable on success before changing routes.
I think both A and B might be the best option. We should be using ReactiveVar for this, rather than session. And we also should allow the AutoForm endSubmit to run, even though the ReactiveVar approach would work fine even if endSubmit never executes.
When
RouterLayer.go
is called in the onSuccess hook in the materialize theme, it causes the current template to be destroyed. Because of this, the endSubmit hook does not execute. It checks the template before running and does not call the endSubmit hook if the template is destroyed or doesn't exist.As a result, the Session variable that controls the disabled state of the submit buttons is never reset and the buttons remain disabled on forms.
Several possible solutions. A) don't use a session variable, so the state does not leak to other template instances. B) defer the router action so that the AutoForm hooks can complete before the template is destroyed. C) reset the Session variable on success before changing routes.
I think both A and B might be the best option. We should be using ReactiveVar for this, rather than session. And we also should allow the AutoForm endSubmit to run, even though the ReactiveVar approach would work fine even if endSubmit never executes.