Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jsx/dom): skip calculate children if props are the same #3049

Merged
merged 3 commits into from
Jun 29, 2024

Conversation

usualoma
Copy link
Member

Oops, the biggest point of React, the feature of not calculating the child element again if the properties are exactly the same, was not implemented. So it seems that https://github.com/orgs/honojs/discussions/3044 did not give the expected result.

If this pull request is merged, it would benefit from optimisation by React Compiler.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@usualoma
Copy link
Member Author

@yusukebe re-created!

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.03%. Comparing base (afa44e9) to head (6f0e559).

Additional details and impacted files
@@           Coverage Diff            @@
##             next    #3049    +/-   ##
========================================
  Coverage   96.02%   96.03%            
========================================
  Files         142      142            
  Lines       14271    14289    +18     
  Branches     2445     2592   +147     
========================================
+ Hits        13704    13722    +18     
  Misses        567      567            

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

@yusukebe
Copy link
Member

@usualoma Thanks!

@sor4chi Can you review this?

@sor4chi
Copy link
Contributor

sor4chi commented Jun 27, 2024

Hi, @usualoma

Thanks for fixing it.
When I built the PR code in my environment and then set up the example ReactCompiler sample code as dev and accessed it, I encountered a mysterious behaviour where the text and handlers disappear after the DOM is rendered. Could you please try to reproduce this?

Screen.Recording.2024-06-27.at.17.39.20.mov

@usualoma
Copy link
Member Author

@sor4chi Thank you. Sorry for the hassle.

In my environment, it works as follows.

CleanShot.2024-06-27.at.18.22.43.mp4

I've built and archived the hono from this pull request branch into a tgz archive and created a version to install from there, so can I ask you to try this again with the node_modules removed?

https://github.com/usualoma/explore-react-compiler-with-hono-jsx/tree/install-hono-via-tgz

@sor4chi
Copy link
Contributor

sor4chi commented Jun 28, 2024

Sorry, I tried it in various ways, tgz, local link, etc, but it didn't work. Maybe it's my environment...
Can you try this? @yusukebe

@yusukebe
Copy link
Member

@sor4chi @usualoma

It works well on my machine!

Area.mp4

@sor4chi
Copy link
Contributor

sor4chi commented Jun 28, 2024

Thanks, the test looks fine and it seems to be completely my environment.
I have no problem proceeding as it is!

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

@sor4chi Okay! Thank you for reviewing.

@usualoma I'll merge this into the next and release the 4.5.0-rc.2 now. Thanks!

@yusukebe yusukebe merged commit a8a84f3 into honojs:next Jun 29, 2024
14 checks passed
@usualoma usualoma deleted the feat/skip-build-if-same-props-2 branch October 26, 2024 07:36
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.

3 participants