Coder Social home page Coder Social logo

Comments (9)

aiba avatar aiba commented on June 19, 2024 1

You can use dep.edn with shadow-CLJS as laid out in their user guide.

Oh wow, thanks for pointing this out!

Using that, I got fast-refresh working with react-native. I realized you actually want to tell react-native to "Disable Fast Refresh" in the simulator. Otherwise, it tries to do its own fast-refresh hooking which does not jive with shadow-cljs recompile/reload cycles.

Anyway, here's a working example project for anyone interested: https://github.com/aiba/helix-react-native.

I'm really excited to port all my hx code to helix and to be able to use fast-refresh!

from helix.

lilactown avatar lilactown commented on June 19, 2024

In the future, please report what you mean by "broken." e.g. if it doesn't reload at all, or throws an error, etc.

That was fixed in 7edfe88. I'll prepare a new release soon, but in the meantime you can depend directly on that commit using deps.edn.

FWIW, the fast refresh support is still very experimental and does not work in all cases: edits to namespaces which components transitively dependent on will not trigger a proper refresh.

from helix.

khmelevskii avatar khmelevskii commented on June 19, 2024

@Lokeh sure.
but unfortunately fast refresh doesn't work for me. I tried to use last commit and it didn't help.
About "broken" - I mean that I can't see any exceptions but refresh doesn't work.
So, this feature works correctly in this commit e43b5ed and doesn't work after it (tried to use last commit too).

from helix.

lilactown avatar lilactown commented on June 19, 2024

Ah, I think another change I made is biting you. Apologies for the out of date documentation.

In order to enable fast refresh, you must also create a function to inject the global React devtools hooks, and an after-load hook that will call helix.experimental.refresh/refresh!.

An example would be:

(ns my-app.dev
  (:require [helix.experimental.refresh :as refresh])

(refresh/inject-hook!)

(defn ^:dev/after-load after-load []
  (refresh/refresh!))

And include this in your app at dev time. With shadow-cljs, adding it to your preloads should work.

Let me know if this does or does not fix it for you. Thanks!

from helix.

aiba avatar aiba commented on June 19, 2024

Looks like refresh/inject-hook! was introduced after the latest release (0.0.8). Can we cut a new release? (Alternatively, is there is a way for shadow-cljs to depend on a git repo/commit, the way you can with deps.edn?)

from helix.

lilactown avatar lilactown commented on June 19, 2024

You can use dep.edn with shadow-CLJS as laid out in their user guide.

I will cut a new release tomorrow.

from helix.

khmelevskii avatar khmelevskii commented on June 19, 2024

@Lokeh thank you! inject-hook! works correct. Only one thing, as I can see helix.experimental.refresh includes to production build but it would be great to remove this code on prod.

from helix.

lilactown avatar lilactown commented on June 19, 2024

@Lokeh thank you! inject-hook! works correct. Only one thing, as I can see helix.experimental.refresh includes to production build but it would be great to remove this code on prod.

Yes, you should configure your project to only include this code in development - either by adding it to user.cljs or by adding it to a namespace that is loaded via :preloads.

from helix.

khmelevskii avatar khmelevskii commented on June 19, 2024

@Lokeh thank you. Everything works great!

from helix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.