diff options
author | bobzel <zzzman@gmail.com> | 2024-05-17 14:55:36 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-05-17 14:55:36 -0400 |
commit | 0b451af28e5aef6b749da61e8a9fcd0a840789ac (patch) | |
tree | bdee4e28ee4715b69299a8da1b615c70b6adc445 /src/client/views/ObservableReactComponent.tsx | |
parent | 8c1b420a143e4b72ec551277887c211ca6ca003b (diff) | |
parent | 38a382a03675d6a50ec7de75f05025efd093f570 (diff) |
merged with new master
Diffstat (limited to 'src/client/views/ObservableReactComponent.tsx')
-rw-r--r-- | src/client/views/ObservableReactComponent.tsx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/client/views/ObservableReactComponent.tsx b/src/client/views/ObservableReactComponent.tsx index 394d1eae2..34da82b6c 100644 --- a/src/client/views/ObservableReactComponent.tsx +++ b/src/client/views/ObservableReactComponent.tsx @@ -1,6 +1,8 @@ import { action, makeObservable, observable } from 'mobx'; import * as React from 'react'; import './AntimodeMenu.scss'; +import { observer } from 'mobx-react'; +import JsxParser from 'react-jsx-parser'; /** * This is an abstract class that serves as the base for a PDF-style or Marquee-style @@ -14,7 +16,19 @@ export abstract class ObservableReactComponent<T> extends React.Component<T, {}> makeObservable(this); } componentDidUpdate(prevProps: Readonly<T>): void { - Object.keys(prevProps).filter(pkey => (prevProps as any)[pkey] !== (this.props as any)[pkey]).forEach(action(pkey => - ((this._props as any)[pkey] = (this.props as any)[pkey]))); // prettier-ignore + Object.keys(prevProps) + .filter(pkey => (prevProps as any)[pkey] !== (this.props as any)[pkey]) + .forEach(action(pkey => { + (this._props as any)[pkey] = (this.props as any)[pkey]; + })); // prettier-ignore } } + +class ObserverJsxParser1 extends JsxParser { + constructor(props: any) { + super(props); + observer(this as any); + } +} + +export const ObserverJsxParser: typeof JsxParser = ObserverJsxParser1 as any; |