mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 13:21:59 +00:00
Fixed an issue regarding the scroll root path (#201)
* Changed so searching for the scroll root node will look through siblings of children nodes. * Added a missing await Seem to have missed an await from when I was converting my proof-of-concept to an async function. * Minor stylistic change * Changed where program retries to find the scroll root.
This commit is contained in:
+18
-11
@@ -47,18 +47,25 @@ class TabsHook extends Logger {
|
|||||||
const self = this;
|
const self = this;
|
||||||
const tree = (document.getElementById('root') as any)._reactRootContainer._internalRoot.current;
|
const tree = (document.getElementById('root') as any)._reactRootContainer._internalRoot.current;
|
||||||
let scrollRoot: any;
|
let scrollRoot: any;
|
||||||
let currentNode = tree;
|
async function findScrollRoot(currentNode: any, iters: number): Promise<any> {
|
||||||
|
if (iters >= 30) {
|
||||||
|
await sleep(5000);
|
||||||
|
return await findScrollRoot(tree, 0);
|
||||||
|
}
|
||||||
|
currentNode = currentNode?.child;
|
||||||
|
if (currentNode?.type?.prototype?.RemoveSmartScrollContainer) return currentNode;
|
||||||
|
if (!currentNode) return null;
|
||||||
|
if (currentNode.sibling) {
|
||||||
|
let node = await findScrollRoot(currentNode.sibling, iters++);
|
||||||
|
if (node !== null) return node;
|
||||||
|
}
|
||||||
|
return await findScrollRoot(currentNode, iters++);
|
||||||
|
}
|
||||||
(async () => {
|
(async () => {
|
||||||
let iters = 0;
|
scrollRoot = await findScrollRoot(tree, 0);
|
||||||
while (!scrollRoot) {
|
if (!scrollRoot) {
|
||||||
iters++;
|
this.error('Failed to find scroll root node!');
|
||||||
currentNode = currentNode?.child;
|
return;
|
||||||
if (iters >= 30 || !currentNode) {
|
|
||||||
iters = 0;
|
|
||||||
currentNode = tree;
|
|
||||||
await sleep(5000);
|
|
||||||
}
|
|
||||||
if (currentNode?.type?.prototype?.RemoveSmartScrollContainer) scrollRoot = currentNode;
|
|
||||||
}
|
}
|
||||||
let newQA: any;
|
let newQA: any;
|
||||||
let newQATabRenderer: any;
|
let newQATabRenderer: any;
|
||||||
|
|||||||
Reference in New Issue
Block a user