= (props) => {
const navigate = useNavigate();
- // check for an active clan uri and redirect to it on first load
- const activeURI = activeClanURI();
- if (!props.location.pathname.startsWith("/clans/") && activeURI) {
- navigateToClan(navigate, activeURI);
- } else {
- navigate("/");
- }
+ // check for an active clan uri and redirect if no clan is active
+ createEffect(
+ on(activeClanURI, (activeURI) => {
+ console.debug("Active Clan URI changed:", activeURI);
+ if (activeURI && !props.location.pathname.startsWith("/clans/")) {
+ navigateToClan(navigate, activeURI);
+ } else {
+ navigate("/");
+ }
+ }),
+ );
return
{props.children}
;
};
diff --git a/pkgs/clan-app/ui/src/scene/RenderLoop.ts b/pkgs/clan-app/ui/src/scene/RenderLoop.ts
index 4046ad2a9..746e95ecd 100644
--- a/pkgs/clan-app/ui/src/scene/RenderLoop.ts
+++ b/pkgs/clan-app/ui/src/scene/RenderLoop.ts
@@ -62,6 +62,11 @@ class RenderLoop {
this.renderRequested = true;
requestAnimationFrame(() => {
+ if (!this.initialized) {
+ console.log("RenderLoop not initialized, skipping render.");
+ return;
+ }
+
this.updateTweens();
const needsUpdate = this.controls.update(); // returns true if damping is ongoing
@@ -69,6 +74,7 @@ class RenderLoop {
this.render();
this.renderRequested = false;
+ // Controls smoothing may require another render
if (needsUpdate) {
this.requestRender();
}
diff --git a/pkgs/clan-app/ui/src/stores/clan.ts b/pkgs/clan-app/ui/src/stores/clan.ts
index c9cb52264..658df6dbc 100644
--- a/pkgs/clan-app/ui/src/stores/clan.ts
+++ b/pkgs/clan-app/ui/src/stores/clan.ts
@@ -41,7 +41,8 @@ const activeClanURI = () => store.activeClanURI;
*
* @param {string} uri - The URI to be set as the active Clan URI.
*/
-const setActiveClanURI = (uri: string) => setStore("activeClanURI", uri);
+const setActiveClanURI = (uri: string | undefined) =>
+ setStore("activeClanURI", uri);
/**
* Retrieves the current list of clan URIs from the store.