opencode-session-bar 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.tsx +8 -8
- package/package.json +1 -1
package/index.tsx
CHANGED
|
@@ -14,6 +14,7 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
14
14
|
const sorted = () => (sessions() ?? [])
|
|
15
15
|
.slice()
|
|
16
16
|
.sort((a, b) => b.time.updated - a.time.updated)
|
|
17
|
+
.slice(0, 5)
|
|
17
18
|
|
|
18
19
|
async function handleSwitch(id: string) {
|
|
19
20
|
props.api.route.navigate("session", { sessionID: id })
|
|
@@ -30,6 +31,12 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
30
31
|
setDeleting(prev => { const next = new Set(prev); next.delete(id); return next })
|
|
31
32
|
}
|
|
32
33
|
}
|
|
34
|
+
onMount(() => {
|
|
35
|
+
const unsub1 = props.api.event.on("session.updated", () => refetch())
|
|
36
|
+
const unsub2 = props.api.event.on("session.deleted", () => refetch())
|
|
37
|
+
const unsub3 = props.api.event.on("session.created", () => refetch())
|
|
38
|
+
onCleanup(() => { unsub1(); unsub2(); unsub3() })
|
|
39
|
+
})
|
|
33
40
|
|
|
34
41
|
return (
|
|
35
42
|
<box>
|
|
@@ -43,14 +50,7 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
43
50
|
<For each={sorted()}>
|
|
44
51
|
{(session) => {
|
|
45
52
|
const isDeleting = deleting().has(session.id)
|
|
46
|
-
|
|
47
|
-
const unsub1 = props.api.event.on("session.updated", () => refetch())
|
|
48
|
-
const unsub2 = props.api.event.on("session.deleted", () => refetch())
|
|
49
|
-
const unsub3 = props.api.event.on("session.created", () => refetch())
|
|
50
|
-
onCleanup(() => { unsub1(); unsub2(); unsub3() })
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
return (
|
|
53
|
+
return (
|
|
54
54
|
<box flexDirection="row" justifyContent="space-between" overflow="hidden">
|
|
55
55
|
<text
|
|
56
56
|
fg={theme().textMuted}
|