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

[Bug] movies example, onMount does not fire #1049

Closed
2 tasks done
trusktr opened this issue Sep 5, 2023 · 2 comments
Closed
2 tasks done

[Bug] movies example, onMount does not fire #1049

trusktr opened this issue Sep 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@trusktr
Copy link

trusktr commented Sep 5, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

I started testing out Solid Start using the Movies example. I want to get code runing on the client.

I think that I got components running on the client by setting islands and islandsRouter both to false.

When I do this, then my module will call LUME.defineElements() on the client at the top level of a module, f.e.

// this is top-level of a module
if (globalThis.window) { // client only
  const { defineElements } = await import("lume")
  defineElements()
}

However, code inside of onMount of a component defined in the same file as that above code does not run.

Expected behavior 🤔

onMount runs

Steps to reproduce 🕹

Steps:

  1. bootstrap with the movies example
  2. turn off islands and islandsRouter
  3. put a if (globalThis.window) console.log('...') at the top level of PersonInfo.ts
  4. put a console.log in onMount in the PersonInfo component
  5. observe behavior:
  6. onMount does not run.
  7. there's also an error in console: TypeError: Cannot read properties of undefined (reading 'router')

Context 🔦

Run code on the client side (I started with the movies example, haven't tried others).

Your environment 🌎

"devDependencies": {
    "@iconify/json": "^2.2.102",
    "sass": "^1.65.1",
    "solid-start-node": "^0.3.5",
    "typescript": "^4.9.5",
    "unplugin-icons": "^0.14.15",
    "vite": "^4.4.9"
  },
  "dependencies": {
    "@solid-primitives/scheduled": "1.1.0",
    "@solidjs/meta": "^0.28.6",
    "@solidjs/router": "^0.8.3",
    "lume": "^0.3.0-alpha.27",
    "nprogress": "^0.2.0",
    "solid-heroicons": "^3.2.4",
    "solid-js": "^1.7.11",
    "solid-start": "^0.3.5",
    "solid-start-netlify": "^0.3.5"
  },
node -v
v18.13.0
Chredge 116.0.1938.62
@trusktr trusktr added the bug Something isn't working label Sep 5, 2023
@edivados
Copy link
Contributor

edivados commented Sep 6, 2023

I remember reading that some examples (including movies) are meant to demo islands architecture so I am assuming it does not work properly when disabling it. It's probably relying on the islands router being present.

Edit: Ahh here

We have updated Docs, and added Movies and Notes apps. These only really work under this Islands mode and will serve as a basis as we fill in the features as we work on the R&D that is being funding by the Chrome team.

If you want to use the movies example and make onMount work this should do it:

  • Enable islands and islandsRouter
  • Add "use client"; directive to the top of PersonInfo.tsx

In case you are on Windows build may not work because of #1046

@ryansolid
Copy link
Member

Yeah onMount doesn't work on server components. We need better detection errors here.. However, this example is completely experimental so I think that's ok and not ready for use.

In setting up for SolidStart's next Beta Phase built on Nitro and Vinxi we are closing all PRs/Issues that will not be merged due to the system changing. If you feel your issue was closed by mistake. Feel free to re-open it after updating/testing against 0.4.x release. Thank you for your patience.

See #1139 for more details.

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

3 participants