Skip to content

Commit 9e003f9

Browse files
authored
fix: resovled red flash bug during navigation (#58)
1 parent f2a872e commit 9e003f9

7 files changed

Lines changed: 17 additions & 14 deletions

src/components/DevboxCreatePage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ export const DevboxCreatePage = ({
213213
if (input === "q" || key.escape || key.return) {
214214
if (onCreate) {
215215
onCreate(result);
216+
} else {
217+
onBack();
216218
}
217-
onBack();
218219
}
219220
return;
220221
}

src/components/NetworkPolicyCreatePage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,17 @@ export const NetworkPolicyCreatePage = ({
136136
currentField === "allow_devbox_to_devbox",
137137
);
138138

139+
// Main form input handler - active when not in hostnames expanded mode
139140
useInput(
140141
(input, key) => {
141142
// Handle result screen
142143
if (result) {
143144
if (input === "q" || key.escape || key.return) {
144145
if (onCreate) {
145146
onCreate(result);
147+
} else {
148+
onBack();
146149
}
147-
onBack();
148150
}
149151
return;
150152
}

src/screens/BlueprintDetailScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export function BlueprintDetailScreen({
6969
// Use fetched blueprint for full details, fall back to store for basic display
7070
const blueprint = fetchedBlueprint || blueprintFromStore;
7171

72-
// Show loading state while fetching
73-
if (loading && !blueprint) {
72+
// Show loading state while fetching or before fetch starts
73+
if (!blueprint && blueprintId && !error) {
7474
return (
7575
<>
7676
<Breadcrumb

src/screens/DevboxDetailScreen.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function DevboxDetailScreen({ devboxId }: DevboxDetailScreenProps) {
5050
// Use devbox from store or fetched devbox
5151
const devbox = devboxFromStore || fetchedDevbox;
5252

53-
// Show loading state while fetching
54-
if (loading) {
53+
// Show loading state while fetching or before fetch starts
54+
if (!devbox && devboxId && !error) {
5555
return (
5656
<>
5757
<Breadcrumb
@@ -74,8 +74,8 @@ export function DevboxDetailScreen({ devboxId }: DevboxDetailScreenProps) {
7474
);
7575
}
7676

77-
// Show error if no devbox found and not loading
78-
if (!devbox && !loading) {
77+
// Show error if no devbox found
78+
if (!devbox) {
7979
return (
8080
<>
8181
<Breadcrumb

src/screens/NetworkPolicyDetailScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ export function NetworkPolicyDetailScreen({
8686
// Use fetched policy for full details, fall back to store for basic display
8787
const policy = fetchedPolicy || policyFromStore;
8888

89-
// Show loading state while fetching
90-
if (loading && !policy) {
89+
// Show loading state while fetching or before fetch starts
90+
if (!policy && networkPolicyId && !error) {
9191
return (
9292
<>
9393
<Breadcrumb

src/screens/ObjectDetailScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ export function ObjectDetailScreen({ objectId }: ObjectDetailScreenProps) {
143143
{ isActive: showDownloadPrompt || !!downloadResult || !!downloadError },
144144
);
145145

146-
// Show loading state while fetching
147-
if (loading && !storageObject) {
146+
// Show loading state while fetching or before fetch starts
147+
if (!storageObject && objectId && !error) {
148148
return (
149149
<>
150150
<Breadcrumb

src/screens/SnapshotDetailScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export function SnapshotDetailScreen({
6969
// Use fetched snapshot for full details, fall back to store for basic display
7070
const snapshot = fetchedSnapshot || snapshotFromStore;
7171

72-
// Show loading state while fetching
73-
if (loading && !snapshot) {
72+
// Show loading state while fetching or before fetch starts
73+
if (!snapshot && snapshotId && !error) {
7474
return (
7575
<>
7676
<Breadcrumb

0 commit comments

Comments
 (0)