Skip to content

fix: determine if rendered or not by node.vC[0] instead of referring to node.pP#4663

Merged
yusukebe merged 3 commits intomainfrom
fix-jsx-find-node
Feb 8, 2026
Merged

fix: determine if rendered or not by node.vC[0] instead of referring to node.pP#4663
yusukebe merged 3 commits intomainfrom
fix-jsx-find-node

Conversation

@usualoma
Copy link
Member

@usualoma usualoma commented Feb 7, 2026

fix #4661

Summary

This PR fixes DOM insertion anchor resolution in the JSX DOM renderer.

findInsertBefore now determines whether a node is effectively rendered by checking node.vC?.[0] (actual virtual children) instead of relying on node.pP (previous props), which is not a reliable signal for render presence.

Problem

In some update flows (especially with fragments/function components, null siblings, and dynamic child insertion), the previous logic could choose the wrong insertion anchor and cause sibling order issues.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Bundle size check

main (5ca5c3e) #4663 (37cca03) +/-
Bundle Size (B) 18,377B 18,377B 0B
Bundle Size (KB) 17.95K 17.95K 0K

Compiler Diagnostics (tsc)

main (5ca5c3e) #4663 (37cca03) +/-
Files 303 303 0
Lines 141,166 141,166 0
Identifiers 128,937 128,937 0
Symbols 269,498 269,498 0
Types 202,695 202,695 0
Instantiations 609,801 609,801 0
Memory used 335,477K 335,733K 256K
I/O read 0.02s 0.02s 0s
I/O write 0s 0s 0s
Parse time 0.72s 0.81s 0.09s
Bind time 0.3s 0.33s 0.03s
Check time 2.5s 2.57s 0.07s
Emit time 0s 0s 0s
Total time 3.51s 3.7s 0.19s

Compiler Diagnostics (typescript-go)

main (5ca5c3e) #4663 (37cca03) +/-
Files 303 303 0
Lines 141,168 141,168 0
Identifiers 128,900 128,900 0
Symbols 392,603 388,892 -3,711
Types 372,898 372,898 0
Instantiations 984,004 984,004 0
Memory used 254,997K 254,380K -617K
Memory allocs 2,553,384 2,553,418 34
Config time 0.001s 0.001s 0s
Parse time 0.085s 0.092s 0.007s
Bind time 0.033s 0.027s -0.006s
Check time 0.618s 0.559s -0.059s
Emit time 0s 0s 0s
Total time 0.789s 0.727s -0.062s

Reported by octocov

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

HTTP Performance Benchmark

Framework Runtime Average Ping Query Body
hono (origin/main) bun 37,972.09 51,939.25 33,690.03 28,286.99
hono (current) bun 37,873.78 51,254.29 33,771.52 28,595.53
Change -0.26% -1.32% +0.24% +1.09%

@usualoma
Copy link
Member Author

usualoma commented Feb 7, 2026

Hi @yusukebe

Would you please review this?

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.43%. Comparing base (5ca5c3e) to head (5ccd86c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4663      +/-   ##
==========================================
- Coverage   91.43%   91.43%   -0.01%     
==========================================
  Files         173      173              
  Lines       11377    11373       -4     
  Branches     3299     3298       -1     
==========================================
- Hits        10403    10399       -4     
  Misses        973      973              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@yusukebe
Copy link
Member

yusukebe commented Feb 8, 2026

@usualoma

I tried the repo in #4661 ( Thanks @hashrock! ), and it works with this branch. Looks good! Thanks.

@yusukebe yusukebe merged commit 3d536ff into main Feb 8, 2026
20 checks passed
@yusukebe yusukebe deleted the fix-jsx-find-node branch February 8, 2026 12:57
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.

hono/jsx useState State Mixing in Nested Components

2 participants