Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10287-fixed-1710448520468.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Rebuild modal state not being reset properly ([#10287](https://github.com/linode/manager/pull/10287))
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ export const LinodeRebuildDialog = (props: Props) => {
const [mode, setMode] = React.useState<MODES>('fromImage');
const [rebuildError, setRebuildError] = React.useState<string>('');

React.useEffect(() => {
if (open) {
setRebuildError('');
}
}, [open]);
const onExitDrawer = () => {
setRebuildError('');
setMode('fromImage');
};

const handleRebuildError = (status: string) => {
setRebuildError(status);
};

return (
<Dialog
TransitionProps={{ onExited: onExitDrawer }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could frankly stop reseting state with useEffect all together on modal/drawer by resetting it via onClose and TransitionProps

I used TransitionProps here to prevent a DOM change before the modal has closed, which is a nice bonus (you could maybe see the content very briefly otherwise)

fullHeight
fullWidth
maxWidth="md"
Expand All @@ -80,8 +80,8 @@ export const LinodeRebuildDialog = (props: Props) => {
{hostMaintenance && <HostMaintenanceError />}
{rebuildError && <Notice variant="error">{rebuildError}</Notice>}
<Typography
sx={{ paddingBottom: theme.spacing(2) }}
data-qa-rebuild-desc
sx={{ paddingBottom: theme.spacing(2) }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just alpha ordering - no other change

>
If you can&rsquo;t rescue an existing disk, it&rsquo;s time to rebuild
your Linode. There are a couple of different ways you can do this:
Expand Down