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

valtio not working #206

Open
aretrace opened this issue Jul 24, 2024 · 2 comments
Open

valtio not working #206

aretrace opened this issue Jul 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@aretrace
Copy link
Contributor

aretrace commented Jul 24, 2024

What version of HonoX are you using?

0.1.23

What steps can reproduce the bug?

  1. select x-basic template
  2. transition app from hono/jsx to @hono/react-renderer
  3. install valtio: npm i valtio
  4. replace counter island do with valtio counter:
import { proxy, useSnapshot } from "valtio";

const state = proxy({ count: 0 });

export default function Counter() {
  const snap = useSnapshot(state);
  return (
    <div>
      <p>{snap.count}</p>
      <button onClick={() => ++state.count}>Increment</button>
    </div>
  );
}
  1. npm run dev

What is the expected behavior?

a basic incremental counter demo rendering and working

What do you see instead?

module is not defined
at eval (/.../node_modules/use-sync-external-store/shim/index.js:8:3)
at instantiateModule (file:///.../node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:53453:11

[vite] Error when evaluating SSR module /node_modules/use-sync-external-store/shim/index.js:
|- ReferenceError: module is not defined

Additional information

valtio: https://valtio.pmnd.rs

valtio-signal seems to be working, jotai test counter also works

@aretrace aretrace added the bug Something isn't working label Jul 24, 2024
@dai-shi
Copy link

dai-shi commented Jul 25, 2024

Valtio v2 may help: npm i valtio@next

@aretrace
Copy link
Contributor Author

Using Valtio v2:

  • hono/jsx
    • basic counter component using state object from external file: not working
  • hono/jsx && @hono/react-compat
    • basic counter component using state object from external file: working
    • straightforward async using fetch in state object from external file: not working
      • using Suspense
  • @hono/react-renderer
    • basic counter component using state object from external file: working with warnings
    • straightforward async using fetch in state object from external file: not working
      • using Suspense

I encourage testing for each package combinatorial use case as errors differ in most individual cases of a particular mix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants