diff options
author | bobzel <zzzman@gmail.com> | 2024-05-19 00:05:18 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-05-19 00:05:18 -0400 |
commit | 38742d5f491ed5232a381da63e126b609cf14aad (patch) | |
tree | a723b0c9dfffa717b70df383d21fb3b14567308f /src/client/views/ObservableReactComponent.tsx | |
parent | a3784cd3ab990d8016b1168eb0cbf7e9a2f22301 (diff) | |
parent | 0b451af28e5aef6b749da61e8a9fcd0a840789ac (diff) |
Merge branch 'restoringEslint' into aisosa-starter
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; |