Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/desktop-files/settings-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ import {
getUserAssociations,
resolveOpener,
setUserAssociations,
subscribeOpeners,
} from './openers';
import { getTypes } from './registry';
// Pre-registered globally by the lazy shell-overlays bundle (Stage 10) — see src/shell-overlays/entry.ts.

const TAB_ID = 'os-file-associations';

let unsubscribe: ( () => void ) | null = null;

/**
* Register the tab. Called once at bundle boot from
* `src/desktop-files/index.ts`.
Expand All @@ -32,7 +35,21 @@ export function registerFileAssociationsTab(): void {
label: 'File Associations',
order: 50,
render( body ) {
if ( unsubscribe ) {
unsubscribe();
unsubscribe = null;
}
renderTab( body );
unsubscribe = subscribeOpeners( () => {
if ( ! body.isConnected ) {
if ( unsubscribe ) {
unsubscribe();
unsubscribe = null;
}
return;
}
renderTab( body );
} );
},
} );
}
Expand Down