fix: fix flashing error dialog in the create workspace page (#18180)

This PR which updated react-query to 5.77.0 introduced an issue on the
create workspace page where the error dialog would be briefly displayed
while the page is loading. https://github.com/coder/coder/pull/18039

The issue is that there is a moment when `optOutQuery.isLoading` is
false and `optOutQuery.data` is undefined causing the ErrorAlert to
display.
This commit is contained in:
Jaayden Halko
2025-06-02 15:55:05 -05:00
committed by GitHub
parent 1d27d4f719
commit fd6981e514

View File

@ -44,11 +44,11 @@ const CreateWorkspaceExperimentRouter: FC = () => {
});
if (dynamicParametersEnabled) {
if (optOutQuery.isLoading) {
return <Loader />;
if (optOutQuery.isError) {
return <ErrorAlert error={optOutQuery.error} />;
}
if (!optOutQuery.data) {
return <ErrorAlert error={optOutQuery.error} />;
return <Loader />;
}
const toggleOptedOut = () => {