Simplify service lookups with optional chaining

The bar-null-shell-null-typeof-function ternary guarded against our own
shell missing a method it always defines. bar?.shell?.firstPartyServiceFor()
handles the only real case, delayed bar injection, in one line. The
typeof checks that probe genuinely third-party plugin objects stay.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-21 15:26:30 -07:00
co-authored by Claude Fable 5
parent ba91bad3a4
commit 289e6d12fc
4 changed files with 4 additions and 8 deletions
+1 -3
View File
@@ -25,9 +25,7 @@ BarWidget {
// Look up the long-running notifications service through the shell host.
readonly property var hostShell: bar && bar.shell ? bar.shell : null
readonly property var notificationService: hostShell && typeof hostShell.firstPartyServiceFor === "function"
? hostShell.firstPartyServiceFor("omarchy.notifications")
: null
readonly property var notificationService: hostShell?.firstPartyServiceFor("omarchy.notifications")
function isChromiumDerived(app, appIcon) {
return NotificationLogic.isChromiumDerived(app, appIcon)