aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionDockingView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-06 16:17:47 -0500
committerbobzel <zzzman@gmail.com>2025-03-06 16:17:47 -0500
commit5ad858090f3006631062877d90120e3cc505fada (patch)
tree9f87a8e1e7098a1025f6f4aac332dbc854db5be3 /src/client/views/collections/CollectionDockingView.tsx
parent9c2a7c14fd9d0e44609aab30c6323583162009db (diff)
parentadaa107aac8558fa6f46e6ba1263c650c212d506 (diff)
Merge branch 'master' into aarav_edit
Diffstat (limited to 'src/client/views/collections/CollectionDockingView.tsx')
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 539b49c86..e51bc18ef 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -48,8 +48,7 @@ export class CollectionDockingView extends CollectionSubView() {
// eslint-disable-next-line no-use-before-define
@observable public static Instance: CollectionDockingView | undefined = undefined;
- private _reactionDisposer?: IReactionDisposer;
- private _lightboxReactionDisposer?: IReactionDisposer;
+ private _disposers: { [key: string]: IReactionDisposer } = {};
private _containerRef = React.createRef<HTMLDivElement>();
private _flush: UndoManager.Batch | undefined;
private _unmounting = false;
@@ -341,12 +340,12 @@ export class CollectionDockingView extends CollectionSubView() {
this._unmounting = false;
SetPropSetterCb('title', this.titleChanged); // this overrides any previously assigned callback for the property
if (this._containerRef.current) {
- this._lightboxReactionDisposer = reaction(
+ this._disposers.lightbox = reaction(
() => DocumentView.LightboxDoc(),
doc => setTimeout(() => !doc && this.onResize())
);
new ResizeObserver(this.onResize).observe(this._containerRef.current);
- this._reactionDisposer = reaction(
+ this._disposers.docking = reaction(
() => StrCast(this.Document.dockingConfig),
config => {
if (!this._goldenLayout || this._ignoreStateChange !== config) {
@@ -356,12 +355,16 @@ export class CollectionDockingView extends CollectionSubView() {
this._ignoreStateChange = '';
}
);
- reaction(
+ this._disposers.panel = reaction(
() => this._props.PanelWidth(),
- width => !this._goldenLayout && width > 20 && setTimeout(() => this.setupGoldenLayout()), // need to wait for the collectiondockingview-container to have it's width/height since golden layout reads that to configure its windows
+ width => {
+ if (!this._goldenLayout && width > 20) {
+ setTimeout(() => this.setupGoldenLayout());
+ }
+ }, // need to wait for the collectiondockingview-container to have it's width/height since golden layout reads that to configure its windows
{ fireImmediately: true }
);
- reaction(
+ this._disposers.color = reaction(
() => [SnappingManager.userBackgroundColor, SnappingManager.userBackgroundColor],
() => {
clearStyleSheetRules(CollectionDockingView._highlightStyleSheet);
@@ -376,6 +379,7 @@ export class CollectionDockingView extends CollectionSubView() {
componentWillUnmount: () => void = () => {
this._unmounting = true;
+ Object.values(this._disposers).forEach(d => d());
try {
this._goldenLayout.unbind('stackCreated', this.stackCreated);
this._goldenLayout.unbind('tabDestroyed', this.tabDestroyed);
@@ -385,9 +389,6 @@ export class CollectionDockingView extends CollectionSubView() {
setTimeout(() => this._goldenLayout?.destroy());
window.removeEventListener('resize', this.onResize);
window.removeEventListener('mouseup', this.onPointerUp);
-
- this._reactionDisposer?.();
- this._lightboxReactionDisposer?.();
};
// ViewBoxInterface overrides
@@ -426,7 +427,7 @@ export class CollectionDockingView extends CollectionSubView() {
@action
onPointerUp = (): void => {
- window.removeEventListener('pointerup', this.onPointerUp);
+ window.removeEventListener('mouseup', this.onPointerUp);
DragManager.CompleteWindowDrag = undefined;
setTimeout(this.endUndoBatch, 100);
};