diff options
author | bobzel <zzzman@gmail.com> | 2023-12-13 21:17:50 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-12-13 21:17:50 -0500 |
commit | 1cf241544f8063e3d71406238a584299b6ced794 (patch) | |
tree | cb2bf6a71abbe76e8e3ab8d6283c0daab850e0a4 /src/Utils.ts | |
parent | 35f4d108643d310e4e9da107a5839bb74cc6706f (diff) |
cleaned up props/_props handling by inherting from ObservableReactComponent
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index d54760100..3a2bbf9a1 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -440,7 +440,12 @@ export namespace Utils { socket.on(message, (room: any) => handler(socket, room)); } } -export function copyProps(thing: { _prevProps: any; props: any; _props: any }) { +export function copyProps(thing: { props: any; _props: any }, prevProps: any) { + Object.keys(prevProps).forEach(action(pkey => + (prevProps)[pkey] !== (thing.props as any)[pkey] && + ((thing._props as any)[pkey] = (thing.props as any)[pkey]))); // prettier-ignore +} +export function copyPropsFull(thing: { _prevProps: any; props: any; _props: any }) { Object.keys(thing._prevProps).forEach(action(pkey => (thing._prevProps as any)[pkey] !== (thing.props as any)[pkey] && ((thing._props as any)[pkey] = (thing.props as any)[pkey]))); // prettier-ignore |