mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 01:20:20 +02:00
fix: add patch indicator to prevent crashes (#88)
This commit is contained in:
@@ -46,13 +46,21 @@ export function fakeRenderComponent(fun: Function, customHooks: any = {}): any {
|
||||
}
|
||||
|
||||
export function wrapReactType(node: any, prop: any = 'type') {
|
||||
return (node[prop] = { ...node[prop] });
|
||||
if (node[prop]?.__DECKY_WRAPPED) {
|
||||
return node[prop];
|
||||
} else {
|
||||
return (node[prop] = { ...node[prop], __DECKY_WRAPPED: true });
|
||||
}
|
||||
}
|
||||
|
||||
export function wrapReactClass(node: any, prop: any = 'type') {
|
||||
const cls = node[prop];
|
||||
const wrappedCls = class extends cls {};
|
||||
return (node[prop] = wrappedCls);
|
||||
if (node[prop]?.__DECKY_WRAPPED) {
|
||||
return node[prop];
|
||||
} else {
|
||||
const cls = node[prop];
|
||||
const wrappedCls = class extends cls { static __DECKY_WRAPPED = true; };
|
||||
return (node[prop] = wrappedCls);
|
||||
}
|
||||
}
|
||||
|
||||
export function getReactInstance(o: HTMLElement | Element | Node) {
|
||||
|
||||
Reference in New Issue
Block a user