jbilcke-hf HF staff commited on
Commit
726926f
β€’
1 Parent(s): 72947d4

fixing a flaw in the logic

Browse files
src/app/interface/panel/index.tsx CHANGED
@@ -78,36 +78,41 @@ export function Panel({
78
  setTimeout(() => {
79
  startTransition(async () => {
80
 
81
- // console.log(`Loading panel ${panel}..`)
82
-
83
- let newRendered: RenderedScene
84
- try {
85
- newRendered = await newRender({ prompt, width, height })
86
- } catch (err) {
87
- // "Failed to load the panel! Don't worry, we are retrying..")
88
- newRendered = await newRender({ prompt, width, height })
89
- }
90
 
91
- if (newRendered) {
92
- // console.log("newRendered:", newRendered)
93
- setRendered(panelId, newRendered)
94
-
95
- // but we are still loading!
96
- } else {
97
- setRendered(panelId, {
98
- renderId: "",
99
- status: "pending",
100
- assetUrl: "",
101
- alt: "",
102
- maskUrl: "",
103
- error: "",
104
- segments: []
105
- })
106
- setGeneratingImages(panelId, false)
107
- return
108
- }
109
- })
110
- }, enableRateLimiter ? 2000 * panel : 0)
 
 
 
 
 
111
  }, [prompt, width, height])
112
 
113
 
 
78
  setTimeout(() => {
79
  startTransition(async () => {
80
 
81
+ // console.log(`Loading panel ${panel}..`)
82
+
83
+ let newRendered: RenderedScene
84
+ try {
85
+ newRendered = await newRender({ prompt, width, height })
86
+ } catch (err) {
87
+ // "Failed to load the panel! Don't worry, we are retrying..")
88
+ newRendered = await newRender({ prompt, width, height })
89
+ }
90
 
91
+ if (newRendered) {
92
+ // console.log("newRendered:", newRendered)
93
+ setRendered(panelId, newRendered)
94
+
95
+ if (newRendered.status === "completed") {
96
+ setGeneratingImages(panelId, false)
97
+ addToUpscaleQueue(panelId, newRendered)
98
+ }
99
+
100
+ // but we are still loading!
101
+ } else {
102
+ setRendered(panelId, {
103
+ renderId: "",
104
+ status: "pending",
105
+ assetUrl: "",
106
+ alt: "",
107
+ maskUrl: "",
108
+ error: "",
109
+ segments: []
110
+ })
111
+ setGeneratingImages(panelId, false)
112
+ return
113
+ }
114
+ })
115
+ }, enableRateLimiter ? 2000 * panel : 0)
116
  }, [prompt, width, height])
117
 
118
 
src/app/interface/top-menu/index.tsx CHANGED
@@ -50,7 +50,7 @@ export function TopMenu() {
50
  const isGeneratingStory = useStore(state => state.isGeneratingStory)
51
  const atLeastOnePanelIsBusy = useStore(state => state.atLeastOnePanelIsBusy)
52
  const isBusy = isGeneratingStory || atLeastOnePanelIsBusy
53
-
54
  const searchParams = useSearchParams()
55
 
56
  const requestedPreset = (searchParams.get('preset') as PresetName) || defaultPreset
 
50
  const isGeneratingStory = useStore(state => state.isGeneratingStory)
51
  const atLeastOnePanelIsBusy = useStore(state => state.atLeastOnePanelIsBusy)
52
  const isBusy = isGeneratingStory || atLeastOnePanelIsBusy
53
+
54
  const searchParams = useSearchParams()
55
 
56
  const requestedPreset = (searchParams.get('preset') as PresetName) || defaultPreset