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

jsx/dom: All components are memoized. #3567

Closed
usualoma opened this issue Oct 27, 2024 · 0 comments
Closed

jsx/dom: All components are memoized. #3567

usualoma opened this issue Oct 27, 2024 · 0 comments
Labels

Comments

@usualoma
Copy link
Member

What version of Hono are you using?

v4.6.7

What runtime/platform is your app running on?

Any environment.

What steps can reproduce the bug?

Rrender the following app.

const RandomValue = () => <div>{Math.random()}</div>
const RandomApp = () => {
  const [count, setCount] = useState(0)
  return (
    <>
      <RandomValue />
      <div>{count}</div>
      <button onClick={() => setCount(count + 1)}>+</button>
    </>
  )
}

What is the expected behavior?

Since it is not memoized, a random value should be displayed each time it is updated.

CleanShot.2024-10-27.at.21.41.45.mp4

What do you see instead?

The value is not updated.

CleanShot.2024-10-27.at.21.43.20.mp4

Additional information

This bug is due to the fact that the fix was applied incorrectly when checking the behavior of the React Compiler. In order to be memoized by the React Compiler, a different approach is needed to handle memoization.
#3049

@yusukebe yusukebe added bug and removed triage labels Oct 28, 2024
TinsFox pushed a commit to TinsFox/hono that referenced this issue Nov 11, 2024
Fixes honojs#3473
Fixes honojs#3567

* fix(jsx/dom): fix memoization mechanism in dom renderer

* fix(jsx/dom): fix `memo` for DOM renderer

* feat(jsx/dom): implement light weight `memo` function for DOM renderer

* test(jsx/dom): add tests for memoization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants