Skip to content

[Bugs] Fix NodeIconImage crash on unconfigured image hosts - #1276

Merged
Aymericr merged 3 commits into
mainfrom
cursor/node-icon-image-unconfigured-host-e6d6
Nov 12, 2026
Merged

Aymericr merged 3 commits into
mainfrom
cursor/node-icon-image-unconfigured-host-e6d6

Conversation

@Aymericr

@Aymericr Aymericr commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Placing a catalog item whose thumbnail URL is on a host missing from the app's images.remotePatterns (e.g. a production Supabase storage host while running against local Supabase) crashed the editor: the inspector header renders the thumbnail through NodeIconImage, which always used next/image, and Next threw Invalid src prop … hostname is not configured.

NodeIconImage now checks the src against the image config next/image reads (the bundler-inlined __NEXT_IMAGE_OPTS, then ImageConfigContext, then imageConfigDefault; these modules exist across the declared next >=15 range) with Next's own matcher (hasRemoteMatch):

  • Site-relative paths and configured hosts are still optimized.
  • Any other absolute URL renders unoptimized, which skips the loader that throws and loads the image straight from its host.
  • When the config carries no host lists (production builds, where Next doesn't validate hosts either), optimization stays on.
  • artifact:// thumbnails are unchanged.

How to test

  1. Run bun dev in a host app whose remotePatterns lists only specific hosts, then place a catalog item whose thumbnail is on a host that isn't listed. The inspector opens and shows the thumbnail instead of the Next error page.
  2. A thumbnail on a configured host is still served through /_next/image.
  3. Run bun test src/components/ui/node-icon-image.test.tsx in packages/editor. It covers an unconfigured host, a protocol-relative URL, a configured host, a relative path, and a config with no host lists.

Ran locally: the new test, the full packages/editor suite (bun test src), check-types for packages/editor, bun run build and bun run check.

Screenshots / screen recording

N/A — non-visual change

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch
Open in Web Open in Cursor 

Note

Low Risk
Scoped UI fix in a single component with tests; unconfigured hosts skip optimization instead of failing render, with no auth or data-path changes.

Reviewed by Cursor Bugbot for commit 3055ee4. Bugbot is set up for automated code reviews on this repo. Configure here.

@Aymericr Aymericr added the bot:bugs label Nov 12, 2026 — with Cursor
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T14:14:36.792366Z 9973dd0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9973dd02f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


import { ARTIFACT_URL_PREFIX, resolveArtifactUrl } from '@pascal-app/core'
import Image, { type ImageProps } from 'next/image'
import { useImageConfig } from 'next/dist/client/use-image-config'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve compatibility with the declared Next.js versions

For consumers using a supported Next.js 15 release—or even Next 16.0—this import cannot be resolved because those versions do not contain next/dist/client/use-image-config; their image component reads ImageConfigContext directly. Since @pascal-app/editor still declares next: ">=15", merely importing the editor now fails the host build. Read the config through an API/subpath available throughout the supported range, or raise the peer-dependency minimum to the version that introduced this module.

Useful? React with 👍 / 👎.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3d0a006. Configure here.

@Aymericr
Aymericr merged commit 066da3f into main Nov 12, 2026
8 checks passed
@Aymericr
Aymericr deleted the cursor/node-icon-image-unconfigured-host-e6d6 branch November 12, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants