-
Notifications
You must be signed in to change notification settings - Fork 0
ui: list only human-started sessions by default #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -44,9 +44,9 @@ export interface SessionBarConfig { | |||||||||||||||||||||||||
| // "unfinished" drops the sessions that completed, errored, or were stopped, | ||||||||||||||||||||||||||
| // leaving the conversations still going. "all" keeps them. | ||||||||||||||||||||||||||
| statuses?: 'all' | 'unfinished' | ||||||||||||||||||||||||||
| // Only sessions started these ways, e.g. ["cli", "manual"]. Omit for all of | ||||||||||||||||||||||||||
| // them. Laptop sessions never appear whatever this says: there is nothing in | ||||||||||||||||||||||||||
| // the cloud to open. | ||||||||||||||||||||||||||
| // Only sessions started these ways, e.g. ["cli", "manual"]. An empty list | ||||||||||||||||||||||||||
| // means every source. Laptop sessions never appear whatever this says: there | ||||||||||||||||||||||||||
| // is nothing in the cloud to open. | ||||||||||||||||||||||||||
| sources?: string[] | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -234,14 +234,16 @@ export function clearAllTokens(): void { | |||||||||||||||||||||||||
| // standing in and the last week, which is short enough to read at a glance | ||||||||||||||||||||||||||
| // without hiding a session you are likely to reopen. `repo: 'cwd'` falls back | ||||||||||||||||||||||||||
| // to every repository outside a repo, so the bar is never mysteriously empty. | ||||||||||||||||||||||||||
| // The default sources are the ones a person started; `react` and `cron` fire on | ||||||||||||||||||||||||||
| // their own and would bury the sessions you are actually working in. | ||||||||||||||||||||||||||
| export const SESSION_BAR_DEFAULTS: Required<Omit<SessionBarConfig, 'sources'>> & { | ||||||||||||||||||||||||||
| sources: string[] | undefined | ||||||||||||||||||||||||||
| } = { | ||||||||||||||||||||||||||
| hidden: false, | ||||||||||||||||||||||||||
| days: 7, | ||||||||||||||||||||||||||
| repo: 'cwd', | ||||||||||||||||||||||||||
| statuses: 'all', | ||||||||||||||||||||||||||
| sources: undefined, | ||||||||||||||||||||||||||
| sources: ['manual', 'cli', 'mention'], | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new default silently drops SESSION_SOURCES (config.ts:251) has six values and the default keeps three, so
Suggested change
|
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export type ResolvedSessionBar = typeof SESSION_BAR_DEFAULTS | ||||||||||||||||||||||||||
|
|
@@ -257,7 +259,7 @@ export function sessionBar(): ResolvedSessionBar { | |||||||||||||||||||||||||
| if (!raw || typeof raw !== 'object') return { ...SESSION_BAR_DEFAULTS } | ||||||||||||||||||||||||||
| const sources = Array.isArray(raw.sources) | ||||||||||||||||||||||||||
| ? raw.sources.filter((s) => SESSION_SOURCES.includes(s)) | ||||||||||||||||||||||||||
| : undefined | ||||||||||||||||||||||||||
| : null | ||||||||||||||||||||||||||
|
Comment on lines
260
to
+262
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A sources list whose entries are all unknown still resolves to "every source", so a typo now widens the list instead of narrowing it — fall back to the default instead. With
Suggested change
|
||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||
| hidden: raw.hidden === true, | ||||||||||||||||||||||||||
| days: | ||||||||||||||||||||||||||
|
|
@@ -269,9 +271,10 @@ export function sessionBar(): ResolvedSessionBar { | |||||||||||||||||||||||||
| raw.statuses === 'unfinished' || raw.statuses === 'all' | ||||||||||||||||||||||||||
| ? raw.statuses | ||||||||||||||||||||||||||
| : SESSION_BAR_DEFAULTS.statuses, | ||||||||||||||||||||||||||
| // An explicit [] would list nothing at all, which no one means; treat it | ||||||||||||||||||||||||||
| // as "every source", the same as leaving the key out. | ||||||||||||||||||||||||||
| sources: sources && sources.length > 0 ? sources : undefined, | ||||||||||||||||||||||||||
| // An explicit [] would list nothing at all, which no one means; treat it as | ||||||||||||||||||||||||||
| // "every source" — the only way to ask for the automated ones too. Leaving | ||||||||||||||||||||||||||
| // the key out keeps the human-started default. | ||||||||||||||||||||||||||
| sources: sources === null ? SESSION_BAR_DEFAULTS.sources : sources.length > 0 ? sources : undefined, | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README's
sessionBardocs now contradict this behavior and need the same edit.README:188-190 says
sources"lists only sessions started those ways ...; leave it out for all of them", and README:192 says the sample block's values "are what you get with nosessionBarat all". After this change omitting the key hides react/cron and[]is the only way to get them back — nothing in the README mentions either, and sessionBarFilterLabel (the one place that would have explained it in the UI) has no callers, so a user whose automated sessions vanished has no documented path back.