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 memo break hooks in client side #3473

Closed
codehz opened this issue Oct 1, 2024 · 1 comment
Closed

jsx memo break hooks in client side #3473

codehz opened this issue Oct 1, 2024 · 1 comment
Labels

Comments

@codehz
Copy link
Contributor

codehz commented Oct 1, 2024

What version of Hono are you using?

4.6.3

What runtime/platform is your app running on?

Bun

What steps can reproduce the bug?

const Counter = memo(function Counter() {
  const [count, setCount] = useState(0);
  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
});

What is the expected behavior?

the hook should keep working after memoization (to compatible with react) on client side

What do you see instead?

click increment not working, it seems the behavior is different between hono and react, is it expected?

Additional information

No response

@codehz codehz added the triage label Oct 1, 2024
@usualoma
Copy link
Member

usualoma commented Oct 1, 2024

Hi @codehz!

Thanks for the report. This is a bug, and we'll fix it.

@yusukebe yusukebe added bug and removed triage labels Oct 13, 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

3 participants