fix: typecheck after PR train merge
- Add revealed prop to TabContentMemoKey + comparator (PR #94 threads it through TabContent but the memo key lacked it). - Destructure revealed in TabContent body. - openpath-intercept test: provide no-op revealInExplorer default. - prefs test: add browserAllowedLoopback to setPrefs calls (PR #69). - smoke test: drop duplicate encodeHtmlUrl import (PR #193 dup). - index.ts: null-guard ptyManager in session/disposed (PR #130 revert). - locales-fr/nl: avoid unescaped apostrophes in loopback desc (PR #69).
This commit is contained in:
1 parent
504579e144
commit
2357fc08a5
9 files changed
+14
-10
No files matched your search
@@ -135,7 +135,7 @@ interface TabContentProps extends TabContentMemoKey {
|
|||||||
|
|
||||||
/** Render the content of one tab (dispatched by type). */
|
/** Render the content of one tab (dispatched by type). */
|
||||||
const TabContent = memo(function TabContent(props: TabContentProps) {
|
const TabContent = memo(function TabContent(props: TabContentProps) {
|
||||||
const { tab, sessionId, cwd, expanded, onToggleDir, onReferenceFile, ctx, store, visible, onSubagentJump, onOpenDiff } = props
|
const { tab, sessionId, cwd, expanded, revealed, onToggleDir, onReferenceFile, ctx, store, visible, onSubagentJump, onOpenDiff } = props
|
||||||
const scope = { sessionId, cwd }
|
const scope = { sessionId, cwd }
|
||||||
const descriptor = ctx.get('betterSidebar')?.getTab(tab.type)
|
const descriptor = ctx.get('betterSidebar')?.getTab(tab.type)
|
||||||
if (descriptor === undefined) {
|
if (descriptor === undefined) {
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ export const fr: Record<string, string> = {
|
|||||||
settingsBrowserHttpsTitle: 'Ouvrir les pages HTTPS de côté',
|
settingsBrowserHttpsTitle: 'Ouvrir les pages HTTPS de côté',
|
||||||
settingsBrowserHttpsDesc: 'Une fois activé, cliquer sur un lien externe HTTPS du chat ou de l’interface l’ouvre dans la barre latérale. Désactivé par défaut : la plupart des sites HTTPS refusent l’encapsulation, le navigateur système est plus fluide',
|
settingsBrowserHttpsDesc: 'Une fois activé, cliquer sur un lien externe HTTPS du chat ou de l’interface l’ouvre dans la barre latérale. Désactivé par défaut : la plupart des sites HTTPS refusent l’encapsulation, le navigateur système est plus fluide',
|
||||||
settingsBrowserLoopbackTitle: 'Adresses locales autorisées',
|
settingsBrowserLoopbackTitle: 'Adresses locales autorisées',
|
||||||
settingsBrowserLoopbackDesc: 'Liste blanche séparée par des virgules d'adresses de bouclage (ex. localhost:5174 ou 127.0.0.1:8080) que le navigateur de la barre latérale peut visiter ; vide bloque toutes les adresses locales par défaut. Le bac à sable s'applique toujours — les pages ne peuvent pas lire les données de l'interface',
|
settingsBrowserLoopbackDesc: 'Liste blanche séparée par des virgules des adresses de bouclage (ex. localhost:5174 ou 127.0.0.1:8080) que le navigateur de la barre latérale peut visiter ; vide bloque toutes les adresses locales par défaut. Le bac à sable reste actif — les pages ne peuvent pas lire les données de l interface',
|
||||||
settingsBrowserLoopbackPlaceholder: 'ex. localhost:5174, 127.0.0.1:8080',
|
settingsBrowserLoopbackPlaceholder: 'ex. localhost:5174, 127.0.0.1:8080',
|
||||||
browserOpenExternal: 'Ouvrir dans le navigateur',
|
browserOpenExternal: 'Ouvrir dans le navigateur',
|
||||||
browserEmbedBlocked: '{host} a refusé la demande d’encapsulation',
|
browserEmbedBlocked: '{host} a refusé la demande d’encapsulation',
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ export const nl: Record<string, string> = {
|
|||||||
settingsBrowserHttpsTitle: 'HTTPS-pagina\'s in de zijbalk openen',
|
settingsBrowserHttpsTitle: 'HTTPS-pagina\'s in de zijbalk openen',
|
||||||
settingsBrowserHttpsDesc: 'Indien aan, opent een klik op een externe HTTPS-link in de chat of GUI de zijbalk. Standaard uit: de meeste HTTPS-sites weigeren ingebed te worden, dus de systeembrowser is soepeler',
|
settingsBrowserHttpsDesc: 'Indien aan, opent een klik op een externe HTTPS-link in de chat of GUI de zijbalk. Standaard uit: de meeste HTTPS-sites weigeren ingebed te worden, dus de systeembrowser is soepeler',
|
||||||
settingsBrowserLoopbackTitle: 'Toegestane lokale adressen',
|
settingsBrowserLoopbackTitle: 'Toegestane lokale adressen',
|
||||||
settingsBrowserLoopbackDesc: 'Door komma's gescheiden allowlist van loopback-adressen (bijv. localhost:5174 of 127.0.0.1:8080) die de zijbalk-browser kan bezoeken; leeg blokkeert standaard alle lokale adressen. De sandbox blijft van toepassing — pagina's kunnen geen GUI-gegevens lezen',
|
settingsBrowserLoopbackDesc: 'Door komma gescheiden allowlist van loopback-adressen (bijv. localhost:5174 of 127.0.0.1:8080) die de zijbalk-browser kan bezoeken; leeg blokkeert standaard alle lokale adressen. De sandbox blijft van toepassing — pagina s kunnen geen GUI-gegevens lezen',
|
||||||
settingsBrowserLoopbackPlaceholder: 'bijv. localhost:5174, 127.0.0.1:8080',
|
settingsBrowserLoopbackPlaceholder: 'bijv. localhost:5174, 127.0.0.1:8080',
|
||||||
browserOpenExternal: 'Openen in browser',
|
browserOpenExternal: 'Openen in browser',
|
||||||
browserEmbedBlocked: '{host} weigerde ingebed te worden',
|
browserEmbedBlocked: '{host} weigerde ingebed te worden',
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ export interface TabContentMemoKey {
|
|||||||
cwd: string | undefined
|
cwd: string | undefined
|
||||||
visible: boolean
|
visible: boolean
|
||||||
expanded: string[]
|
expanded: string[]
|
||||||
|
/** Files highlighted in the file tree (the "Show in folder" reveal). */
|
||||||
|
revealed: string[]
|
||||||
localeRevision: string
|
localeRevision: string
|
||||||
tabsVersion: number
|
tabsVersion: number
|
||||||
}
|
}
|
||||||
@@ -40,6 +42,7 @@ export function tabContentCompare(prev: TabContentMemoKey, next: TabContentMemoK
|
|||||||
prev.cwd === next.cwd &&
|
prev.cwd === next.cwd &&
|
||||||
prev.visible === next.visible &&
|
prev.visible === next.visible &&
|
||||||
prev.expanded === next.expanded &&
|
prev.expanded === next.expanded &&
|
||||||
|
prev.revealed === next.revealed &&
|
||||||
prev.localeRevision === next.localeRevision &&
|
prev.localeRevision === next.localeRevision &&
|
||||||
prev.tabsVersion === next.tabsVersion
|
prev.tabsVersion === next.tabsVersion
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -946,7 +946,7 @@ export function apply(ctx: Context, config?: SidebarConfig): void {
|
|||||||
// terminals follow the session, not the reconnect grace. Agent terminals
|
// terminals follow the session, not the reconnect grace. Agent terminals
|
||||||
// are owned by the agent lifecycle and are not touched here.
|
// are owned by the agent lifecycle and are not touched here.
|
||||||
ctx.on('session/disposed', (session) => {
|
ctx.on('session/disposed', (session) => {
|
||||||
try { ptyManager.closeSession(session?.id) } catch {}
|
try { ptyManager?.closeSession(session?.id) } catch {}
|
||||||
}, { global: true })
|
}, { global: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ describe('open-path interception', () => {
|
|||||||
takeoverEnabled: () => true,
|
takeoverEnabled: () => true,
|
||||||
currentSessionId: () => 's1',
|
currentSessionId: () => 's1',
|
||||||
openInSidebar: (path, sessionId) => { sidebar.push(`${sessionId}:${path}`) },
|
openInSidebar: (path, sessionId) => { sidebar.push(`${sessionId}:${path}`) },
|
||||||
|
revealInExplorer: () => {},
|
||||||
...overrides,
|
...overrides,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -260,9 +260,9 @@ describe('side card preferences', () => {
|
|||||||
const store = createSidebarStore()
|
const store = createSidebarStore()
|
||||||
// Node environment: no window → the width falls back to PANEL_DEFAULT,
|
// Node environment: no window → the width falls back to PANEL_DEFAULT,
|
||||||
// while the open flag still follows the preference.
|
// while the open flag still follows the preference.
|
||||||
store.setPrefs({ openByDefault: false, defaultWidthPercent: 45, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer: true, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
store.setPrefs({ openByDefault: false, defaultWidthPercent: 45, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer: true, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, browserAllowedLoopback: "", tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
||||||
store.setSession('fresh-session')
|
store.setSession('fresh-session')
|
||||||
expect(store.getPrefs()).toEqual({ openByDefault: false, defaultWidthPercent: 45, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer: true, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
expect(store.getPrefs()).toEqual({ openByDefault: false, defaultWidthPercent: 45, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer: true, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, browserAllowedLoopback: "", tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
||||||
const snapshot = store.getSnapshot()
|
const snapshot = store.getSnapshot()
|
||||||
expect(snapshot.sessionId).toBe('fresh-session')
|
expect(snapshot.sessionId).toBe('fresh-session')
|
||||||
expect(snapshot.state?.panelOpen).toBe(false)
|
expect(snapshot.state?.panelOpen).toBe(false)
|
||||||
@@ -298,7 +298,7 @@ describe('side card preferences', () => {
|
|||||||
|
|
||||||
it('skips the default seed tab when the editor (files window) type is disabled', () => {
|
it('skips the default seed tab when the editor (files window) type is disabled', () => {
|
||||||
const store = createSidebarStore()
|
const store = createSidebarStore()
|
||||||
store.setPrefs({ openByDefault: true, defaultWidthPercent: 30, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer: true, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, tabsEnabled: { editor: false }, viewersEnabled: {}, pluginSettings: {} })
|
store.setPrefs({ openByDefault: true, defaultWidthPercent: 30, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer: true, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, browserAllowedLoopback: "", tabsEnabled: { editor: false }, viewersEnabled: {}, pluginSettings: {} })
|
||||||
store.setSession('no-editor')
|
store.setSession('no-editor')
|
||||||
const state = store.getSnapshot().state!
|
const state = store.getSnapshot().state!
|
||||||
const tabs = allLeaves(state.splits).flatMap(leaf => leaf.tabs)
|
const tabs = allLeaves(state.splits).flatMap(leaf => leaf.tabs)
|
||||||
@@ -308,7 +308,7 @@ describe('side card preferences', () => {
|
|||||||
// editorExplorer modes.
|
// editorExplorer modes.
|
||||||
for (const editorExplorer of [true, false]) {
|
for (const editorExplorer of [true, false]) {
|
||||||
const openStore = createSidebarStore()
|
const openStore = createSidebarStore()
|
||||||
openStore.setPrefs({ openByDefault: true, defaultWidthPercent: 30, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
openStore.setPrefs({ openByDefault: true, defaultWidthPercent: 30, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, browserAllowedLoopback: "", tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
||||||
openStore.setSession(`with-editor-${editorExplorer}`)
|
openStore.setSession(`with-editor-${editorExplorer}`)
|
||||||
const openTabs = allLeaves(openStore.getSnapshot().state!.splits).flatMap(leaf => leaf.tabs)
|
const openTabs = allLeaves(openStore.getSnapshot().state!.splits).flatMap(leaf => leaf.tabs)
|
||||||
expect(openTabs.map(tab => tab.type)).toEqual(['editor'])
|
expect(openTabs.map(tab => tab.type)).toEqual(['editor'])
|
||||||
@@ -318,7 +318,7 @@ describe('side card preferences', () => {
|
|||||||
it('seeds the empty editor home tab (files window) in both editorExplorer modes', () => {
|
it('seeds the empty editor home tab (files window) in both editorExplorer modes', () => {
|
||||||
for (const editorExplorer of [true, false]) {
|
for (const editorExplorer of [true, false]) {
|
||||||
const store = createSidebarStore()
|
const store = createSidebarStore()
|
||||||
store.setPrefs({ openByDefault: true, defaultWidthPercent: 30, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
store.setPrefs({ openByDefault: true, defaultWidthPercent: 30, autoOpenSubagent: true, autoOpenJobs: true, agentTerminalTools: false, bottomPanelAutoTerminal: true, terminalFontFamily: '', terminalFontSize: 13, interceptOpenPath: true, editorExplorer, terminalShell: '', terminalShellArgs: '', titleBarScheme: 'auto', titleBarPresetId: '', customCss: '', titleBarCompat: false, titleBarStripPx: 40, htmlViewerNoSandbox: false, htmlViewerDefaultUnsafe: false, browserNoSandbox: false, browserInterceptLinks: true, browserInterceptHttp: true, browserInterceptHttps: false, browserAllowedLoopback: "", tabsEnabled: {}, viewersEnabled: {}, pluginSettings: {} })
|
||||||
store.setSession(`fresh-${editorExplorer}`)
|
store.setSession(`fresh-${editorExplorer}`)
|
||||||
const tabs = allLeaves(store.getSnapshot().state!.splits).flatMap(leaf => leaf.tabs)
|
const tabs = allLeaves(store.getSnapshot().state!.splits).flatMap(leaf => leaf.tabs)
|
||||||
expect(tabs).toHaveLength(1)
|
expect(tabs).toHaveLength(1)
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { apply, mediaTypeForPath } from '../src/index.ts'
|
|||||||
import { encodeHtmlUrl } from '../src/html-route.ts'
|
import { encodeHtmlUrl } from '../src/html-route.ts'
|
||||||
import * as git from '../src/git.ts'
|
import * as git from '../src/git.ts'
|
||||||
import { listDirectory } from '../src/fs-tree.ts'
|
import { listDirectory } from '../src/fs-tree.ts'
|
||||||
import { encodeHtmlUrl } from '../src/html-route.ts'
|
|
||||||
import { defaultShell, PtyManager, type SidebarPty } from '../src/pty-manager.ts'
|
import { defaultShell, PtyManager, type SidebarPty } from '../src/pty-manager.ts'
|
||||||
import type { SidebarWebRoute, SidebarWebUpgradeRoute } from '../src/context-types.ts'
|
import type { SidebarWebRoute, SidebarWebUpgradeRoute } from '../src/context-types.ts'
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ function makeKey(overrides: Partial<TabContentMemoKey> = {}): TabContentMemoKey
|
|||||||
cwd: '/workspace',
|
cwd: '/workspace',
|
||||||
visible: true,
|
visible: true,
|
||||||
expanded: [],
|
expanded: [],
|
||||||
|
revealed: [],
|
||||||
localeRevision: 'en-US',
|
localeRevision: 'en-US',
|
||||||
tabsVersion: 0,
|
tabsVersion: 0,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
|||||||
Reference in new issue
Block a user