GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): centralize notification state (#34105) · gateway/opencode@5acb253

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/app/src
    • app.tsx
    • context
      • notification.tsx
    • pages
      • home.tsx
      • layout-new.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/src/app.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/app.tsx
+22-12Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { HighlightsProvider } from "@/context/highlights"
3838
import { LanguageProvider, type Locale, useLanguage } from "@/context/language"
3939
import { LayoutProvider } from "@/context/layout"
4040
import { ModelsProvider } from "@/context/models"
41-
import { NotificationProvider } from "@/context/notification"
41+
import { NotificationProvider, useNotification } from "@/context/notification"
4242
import { PermissionProvider } from "@/context/permission"
4343
import { PromptProvider } from "@/context/prompt"
4444
import { ServerConnection, ServerProvider, serverName, useServer } from "@/context/server"
@@ -316,9 +316,7 @@ function ServerScopedProviders(props: ServerScopedShellProps) {
316316
return (
317317
<PermissionProvider directory={props.directory}>
318318
<LayoutProvider>
319-
<NotificationProvider directory={props.directory} sessionID={props.sessionID}>
320-
<ModelsProvider directory={props.directory}>{props.children}</ModelsProvider>
321-
</NotificationProvider>
319+
<ModelsProvider directory={props.directory}>{props.children}</ModelsProvider>
322320
</LayoutProvider>
323321
</PermissionProvider>
324322
)
@@ -345,13 +343,23 @@ function NewAppLayout(props: ParentProps) {
345343
function TargetServerScopedProviders(props: ServerScopedShellProps) {
346344
return (
347345
<PermissionProvider directory={props.directory}>
348-
<NotificationProvider directory={props.directory} sessionID={props.sessionID}>
349-
<ModelsProvider directory={props.directory}>{props.children}</ModelsProvider>
350-
</NotificationProvider>
346+
<MarkSessionNotificationsViewed sessionID={props.sessionID} />
347+
<ModelsProvider directory={props.directory}>{props.children}</ModelsProvider>
351348
</PermissionProvider>
352349
)
353350
}
354351

352+
function MarkSessionNotificationsViewed(props: { sessionID?: () => string | undefined }) {
353+
const notification = useNotification()
354+
createEffect(() => {
355+
const sessionID = props.sessionID?.()
356+
if (!notification.ready() || !sessionID) return
357+
if (notification.session.unseenCount(sessionID) === 0) return
358+
notification.session.markViewed(sessionID)
359+
})
360+
return null
361+
}
362+
355363
function SessionProviders(props: ParentProps) {
356364
return (
357365
<TerminalProvider>
@@ -560,11 +568,13 @@ export function AppInterface(props: {
560568
component={props.router ?? Router}
561569
root={(routerProps) => (
562570
<TabsProvider>
563-
<ServerShell>
564-
<Show when={useSettings().general.newLayoutDesigns()} fallback={routerProps.children}>
565-
<NewAppLayout>{routerProps.children}</NewAppLayout>
566-
</Show>
567-
</ServerShell>
571+
<NotificationProvider>
572+
<ServerShell>
573+
<Show when={useSettings().general.newLayoutDesigns()} fallback={routerProps.children}>
574+
<NewAppLayout>{routerProps.children}</NewAppLayout>
575+
</Show>
576+
</ServerShell>
577+
</NotificationProvider>
568578
</TabsProvider>
569579
)}
570580
>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.