Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
plugins
/
panel
/
geomap
/
components
/
File Content:
ObservablePropsWrapper.tsx
import React, { Component } from 'react'; import { Observable, Unsubscribable } from 'rxjs'; interface Props<T> { watch: Observable<T>; child: React.ComponentType<T>; initialSubProps: T; } interface State<T> { subProps: T; } export class ObservablePropsWrapper<T extends {}> extends Component<Props<T>, State<T>> { sub?: Unsubscribable; constructor(props: Props<T>) { super(props); this.state = { subProps: props.initialSubProps, }; } componentDidMount() { this.sub = this.props.watch.subscribe({ next: (subProps: T) => { this.setState({ subProps }); }, complete: () => {}, error: (err) => {}, }); } componentWillUnmount() { if (this.sub) { this.sub.unsubscribe(); } } render() { const { subProps } = this.state; return <this.props.child {...subProps} />; } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
DebugOverlay.tsx
1811 bytes
0644
MarkersLegend.tsx
5364 bytes
0644
MeasureOverlay.tsx
4541 bytes
0644
MeasureVectorLayer.ts
7111 bytes
0644
ObservablePropsWrapper.tsx
873 bytes
0644
N4ST4R_ID | Naxtarrr