Spaces:
Runtime error
Runtime error
Commit
·
1e61892
1
Parent(s):
e2b43cd
improve ux
Browse files- src/app/main.tsx +10 -5
src/app/main.tsx
CHANGED
@@ -82,11 +82,16 @@ export default function Main() {
|
|
82 |
|
83 |
console.log("got the first version of our scene!", newRendered)
|
84 |
|
|
|
85 |
// detect if type game type changed while we were busy
|
86 |
if (game?.type !== gameRef?.current) {
|
87 |
console.log("game type changed! aborting..")
|
88 |
return
|
|
|
89 |
}
|
|
|
|
|
|
|
90 |
|
91 |
historyRef.current.unshift(newRendered)
|
92 |
setRendered(newRendered)
|
@@ -245,17 +250,17 @@ export default function Main() {
|
|
245 |
const current = new URLSearchParams(Array.from(searchParams.entries()))
|
246 |
current.set("engine", newEngine)
|
247 |
const search = current.toString()
|
248 |
-
const query = search ? `?${search}` : ""
|
249 |
|
250 |
// for some reason, this doesn't work?!
|
251 |
-
router.replace(`${pathname}${query}`, { })
|
252 |
|
253 |
// workaround.. but it is strange that router.replace doesn't work..
|
254 |
-
let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + search.toString()
|
255 |
-
window.history.pushState({path: newurl}, '', newurl)
|
256 |
|
257 |
// actually we don't handle partial reload very well, so let's reload the whole page
|
258 |
-
|
259 |
}
|
260 |
|
261 |
// determine when to show the spinner
|
|
|
82 |
|
83 |
console.log("got the first version of our scene!", newRendered)
|
84 |
|
85 |
+
const fakeNewRendered =
|
86 |
// detect if type game type changed while we were busy
|
87 |
if (game?.type !== gameRef?.current) {
|
88 |
console.log("game type changed! aborting..")
|
89 |
return
|
90 |
+
|
91 |
}
|
92 |
+
// we cheat a bit by displaying the previous image as a placeholder
|
93 |
+
// this is better than displaying a blank image!
|
94 |
+
newRendered.assetUrl = rendered.assetUrl
|
95 |
|
96 |
historyRef.current.unshift(newRendered)
|
97 |
setRendered(newRendered)
|
|
|
250 |
const current = new URLSearchParams(Array.from(searchParams.entries()))
|
251 |
current.set("engine", newEngine)
|
252 |
const search = current.toString()
|
253 |
+
//const query = search ? `?${search}` : ""
|
254 |
|
255 |
// for some reason, this doesn't work?!
|
256 |
+
//router.replace(`${pathname}${query}`, { })
|
257 |
|
258 |
// workaround.. but it is strange that router.replace doesn't work..
|
259 |
+
//let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + search.toString()
|
260 |
+
//window.history.pushState({path: newurl}, '', newurl)
|
261 |
|
262 |
// actually we don't handle partial reload very well, so let's reload the whole page
|
263 |
+
window.location = `${window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + search.toString()}` as any
|
264 |
}
|
265 |
|
266 |
// determine when to show the spinner
|