lilactown / helix

A simple, easy to use library for React development in ClojureScript.
Eclipse Public License 2.0
627 stars 52 forks source link

fast-refresh doesn't re-render with figwheel-main #59

Closed tomekw closed 4 years ago

tomekw commented 4 years ago

Hi @Lokeh! Thank you for Helix!

I'm struggling to use fast-refresh with figwheel-main. I managed to add a ns to :preloads which injects a hook and set up a callback when code changes. Basically something like this:

(ns ^:figwheel-hooks fast-refresh
  (:require [helix.experimental.refresh :as r]))

(r/inject-hook!)

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

I know the refresh callback is invoked as it shows the component in the "updated" list but nothing changes on screen. The code is not re-rendered.

I used react 16.13.1, helix 0.0.11, and react-refresh 0.8.2.

Is there anything else needed? Am I missing something?

And of course I will drop a PR with documentation changes when I make it work :) 👋

tomekw commented 4 years ago

OK, so the problem was I didn't have React Dev Tools installed 🤦🏻‍♂️🕵🏻‍♂️ I will mention this when updating the docs :)

lilactown commented 4 years ago

Oof that is rough! Thank you for the PR