Skip to content

fix(id-web): compare authored src in ImageNodeView.update() (#1392) - #3197

Merged
dezren39 merged 1 commit into
mainfrom
queue/1364-1392-image-src-guard
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1364-1392-image-src-guard

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1392.

Problem

ImageNodeView.update() guarded its src sync with if (this.img.src !== node.attrs.src), but the img.src getter returns the resolved absolute URL while node.attrs.src is the authored relative value (id images are relative, e.g. /api/images/...). The guard never matched, so every update — unrelated edits, collab re-renders — reassigned img.src and restarted the image load (flicker/refetch).

Fix

Compare against the authored attribute instead: this.img.getAttribute("src") !== (node.attrs.src || ""). Changed-src and cleared-src paths still assign exactly once.

Tests

  • New update() src sync (#1392) block in image-node-view.test.ts with a setter-spy on the real img element:
    • unchanged update performs zero img.src assignments;
    • changed src assigns exactly once; clearing assigns once and empties the attribute.
  • Fail-first: the unchanged-update test fails on the old implementation (pathspec stash of the .ts only); the changed/cleared test pins existing behavior.
  • Laptop: bunx vitest run src/image-node-view.test.ts 14/14 pass; bunx tsc --noEmit clean.

Queue task 1364.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 19:51
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 59b9ed28-3919-49c1-adad-956b9cb5f285
Commits

Reviewing files that changed from the base of the PR and between c9877f8 and 20496ae.

Files selected for processing: 2
  • pkgs/id/web/src/image-node-view.test.ts
  • pkgs/id/web/src/image-node-view.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T19:52:52.885797Z 20496ae 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(web): ImageNodeView.update() reassigns img.src on every update for relative sources — images reload/flicker on unrelated edits

1 participant