-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(webapp): correct button disabling state broken by Remix v2 useNav… #4235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -383,7 +383,7 @@ function DeleteAlertChannelButton(props: { id: string }) { | |||||||||
|
|
||||||||||
| const isLoading = | ||||||||||
| navigation.state !== "idle" && | ||||||||||
| navigation.formMethod === "post" && | ||||||||||
| navigation.formMethod === "POST" && | ||||||||||
| navigation.formData?.get("action") === "delete"; | ||||||||||
|
|
||||||||||
| const [form] = useForm({ | ||||||||||
|
|
@@ -422,7 +422,7 @@ function DisableAlertChannelButton(props: { id: string }) { | |||||||||
|
|
||||||||||
| const isLoading = | ||||||||||
| navigation.state !== "idle" && | ||||||||||
| navigation.formMethod === "post" && | ||||||||||
| navigation.formMethod === "POST" && | ||||||||||
| navigation.formData?.get("action") === "delete"; | ||||||||||
|
|
||||||||||
| const [form] = useForm({ | ||||||||||
|
|
@@ -462,7 +462,7 @@ function EnableAlertChannelButton(props: { id: string }) { | |||||||||
|
|
||||||||||
| const isLoading = | ||||||||||
| navigation.state !== "idle" && | ||||||||||
| navigation.formMethod === "post" && | ||||||||||
| navigation.formMethod === "POST" && | ||||||||||
| navigation.formData?.get("action") === "delete"; | ||||||||||
|
Comment on lines
+465
to
466
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Enable-alert button never shows its loading indicator The loading-state check looks for the action value Impact: Users get no visual feedback that the enable action is in progress. Action value mismatch inherited from copy-paste of DeleteAlertChannelButtonThe <Button name="action" value="enable" ...>
{isLoading ? "Enabling" : "Enable"}
</Button>Before this PR, the bug was masked because
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||
|
|
||||||||||
| const [form] = useForm({ | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Disable-alert button never shows its loading indicator
The loading-state check looks for the action value
"delete"(navigation.formData?.get("action") === "delete"atapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx:426) but the button actually submits"disable"(line 444), so the condition is never true and the button text stays as "Disable" instead of changing to "Disabling" during submission.Impact: Users get no visual feedback that the disable action is in progress.
Action value mismatch inherited from copy-paste of DeleteAlertChannelButton
The
DisableAlertChannelButtoncomponent'sisLoadingexpression was copy-pasted fromDeleteAlertChannelButtonatapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx:384-387, which correctly checks for"delete". The value was never updated to"disable"to match the button at line 444:Before this PR, the bug was masked because
formMethod === "post"(lowercase) never matched Remix v2's uppercase"POST", makingisLoadingalways false for a different reason. Now that the PR correctly uses"POST", this action-value mismatch becomes the sole reasonisLoadingis broken.Was this helpful? React with 👍 or 👎 to provide feedback.