mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 23:41:59 +00:00
fix router hook recursively wrapping routes when patched multiple times
This commit is contained in:
@@ -22,6 +22,8 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPatched = Symbol('is patched');
|
||||||
|
|
||||||
class RouterHook extends Logger {
|
class RouterHook extends Logger {
|
||||||
private router: any;
|
private router: any;
|
||||||
private memoizedRouter: any;
|
private memoizedRouter: any;
|
||||||
@@ -90,9 +92,10 @@ class RouterHook extends Logger {
|
|||||||
...routeList[index].props,
|
...routeList[index].props,
|
||||||
children: {
|
children: {
|
||||||
...cloneElement(routeList[index].props.children),
|
...cloneElement(routeList[index].props.children),
|
||||||
type: (props) => createElement(oType, props),
|
type: routeList[index].props.children[isPatched] ? oType : (props) => createElement(oType, props),
|
||||||
},
|
},
|
||||||
}).children;
|
}).children;
|
||||||
|
routeList[index].props.children[isPatched] = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user