From ab05105e5ee5e5e218071787f9e8897f1d3bafa2 Mon Sep 17 00:00:00 2001 From: Juergen Gmeiner Date: Sat, 22 Oct 2022 20:11:31 +0200 Subject: [PATCH] warn-when-not-reactive: funcall vs. component use writing (subscribing-component) instead of [subscribing-component] will run the subscription when the hiccup is built instead of when it is rendered, leading to the warning from warn-when-not-reactive --- docs/releases/2022.md | 4 ++++ src/re_frame/subs.cljc | 1 + 2 files changed, 5 insertions(+) diff --git a/docs/releases/2022.md b/docs/releases/2022.md index 54274cf88..a705b51f3 100644 --- a/docs/releases/2022.md +++ b/docs/releases/2022.md @@ -10,6 +10,10 @@ > Committed but unreleased changes are put here, at the top. Older releases are detailed chronologically below. +#### Changed + +- warn-when-not-reactive mentions another likely reason: `(subscribing-component)` instead of `[subscribing-component]` + #### Breaking - [763](https://github.com/day8/re-frame/pull/763) on detecting an incorrect event structure, the `unwrap` interceptor now exceptions instead of writing an error to `js/console` and continuing diff --git a/src/re_frame/subs.cljc b/src/re_frame/subs.cljc index 86149d149..36581f0bf 100644 --- a/src/re_frame/subs.cljc +++ b/src/re_frame/subs.cljc @@ -68,6 +68,7 @@ (when (and debug-enabled? (not (reactive?))) (console :warn "re-frame: Subscribe was called outside of a reactive context.\n" + "Did you mean `[subscribing-component]` but wrote `(subscribing-component)`?\n" "See: https://day8.github.io/re-frame/FAQs/UseASubscriptionInAJsEvent/\n" "https://day8.github.io/re-frame/FAQs/UseASubscriptionInAnEventHandler/")))