Comments (9)
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.
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.
@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.
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.
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.
You can use dep.edn with shadow-CLJS as laid out in their user guide.
I will cut a new release tomorrow.
from helix.
@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.
@Lokeh thank you!
inject-hook!
works correct. Only one thing, as I can seehelix.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 adding it to a namespace that is loaded via user.cljs
or by:preloads
.
from helix.
@Lokeh thank you. Everything works great!
from helix.
Related Issues (20)
- gensym / anonymous function syntax breaks fast refresh HOT 2
- Include resources in deps.edn :paths
- $ clj-kondo hook fails to lint & right when component is not a symbol
- The $ macro and new JSX transform HOT 14
- `wrap-fx` is public HOT 1
- Wrappers for useTransition, useDeferredValue, etc. HOT 1
- Is it possible to bypass the camel-casing of properties? HOT 7
- Add wrapper around createRef with atom protocols HOT 2
- How to use with uikit? HOT 2
- Running tests in nodejs with jsdom HOT 4
- Companies using Helix HOT 1
- indent metadata on helix.dom macros HOT 3
- Create use-isomorphic-layout-effect HOT 6
- Make self-hosted CLJS compatible HOT 2
- Fix indentation with CIDER HOT 3
- Release request HOT 1
- Warning: React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead. HOT 2
- `helix.dom/tags` removed HOT 2
- defnc taking pre- & post-conditions HOT 1
- Release request HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helix.