summaryrefslogtreecommitdiff
path: root/frontend/src/tabs-hook.ts
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-09-04 13:33:42 -0400
committerAAGaming <aa@mail.catvibers.me>2022-09-04 13:33:42 -0400
commitacaf6c72e48e2bbb42b921292d49c1d157306d0b (patch)
tree0a93c06a0cb01186edde9bfdef5aace71308ae54 /frontend/src/tabs-hook.ts
parenteb439574becb9a82c283d513a98440d7c8efbafe (diff)
downloaddecky-loader-acaf6c72e48e2bbb42b921292d49c1d157306d0b.tar.gz
decky-loader-acaf6c72e48e2bbb42b921292d49c1d157306d0b.zip
Update decky-frontend-lib and refactor patches
Diffstat (limited to 'frontend/src/tabs-hook.ts')
-rw-r--r--frontend/src/tabs-hook.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/frontend/src/tabs-hook.ts b/frontend/src/tabs-hook.ts
index ffa87464..be413de0 100644
--- a/frontend/src/tabs-hook.ts
+++ b/frontend/src/tabs-hook.ts
@@ -1,4 +1,4 @@
-import { QuickAccessTab, afterPatch, sleep, unpatch } from 'decky-frontend-lib';
+import { Patch, QuickAccessTab, afterPatch, sleep } from 'decky-frontend-lib';
import { memo } from 'react';
import Logger from './logger';
@@ -35,6 +35,8 @@ class TabsHook extends Logger {
private qAPTree: any;
private rendererTree: any;
+ private cNodePatch?: Patch;
+
constructor() {
super('TabsHook');
@@ -60,7 +62,7 @@ class TabsHook extends Logger {
}
let newQA: any;
let newQATabRenderer: any;
- afterPatch(scrollRoot.stateNode, 'render', (_: any, ret: any) => {
+ this.cNodePatch = afterPatch(scrollRoot.stateNode, 'render', (_: any, ret: any) => {
if (!this.quickAccess && ret.props.children.props.children[4]) {
this.quickAccess = ret?.props?.children?.props?.children[4].type;
newQA = (...args: any) => {
@@ -103,7 +105,7 @@ class TabsHook extends Logger {
}
deinit() {
- if (this.cNode) unpatch(this.cNode.stateNode, 'render');
+ this.cNodePatch?.unpatch();
if (this.qAPTree) this.qAPTree.type = this.quickAccess;
if (this.rendererTree) this.rendererTree.type = this.tabRenderer;
if (this.cNode) this.cNode.stateNode.forceUpdate();