warn-when-not-reactive: funcall vs. component use#766
Closed
grmble wants to merge 1 commit intoday8:masterfrom
Closed
warn-when-not-reactive: funcall vs. component use#766grmble wants to merge 1 commit intoday8:masterfrom
grmble wants to merge 1 commit intoday8:masterfrom
Conversation
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
Contributor
|
Hey, thanks for the PR. I think it's extraneous, though. (component) just isn't a hiccup. I am working on a clearer explanation for "reactive context," though, because you're right -- there's more to that concern than callbacks and reg-event. As long as we depend on reagent, this will be important to articulate, whether or not we accept 752. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes when I write hiccup, I write (component) instead of [component] which leads to the error message from #752 if component tries to subscribe to something.
The warning as it is now talks about subscribing from event handlers or from javascript events. I found this confusing because I was pretty certain I had not touched any event handlers. But it also said "not in a reactive context" which got me on the right track.
I would argue that this is an even more likely cause for that warning and should be mentionend, especially since this is the more likely error for people new to reagent and/or re-frame. There was no other output besides this warning, just a silently malfunctioning program.
I do not care about the exact wording, but I think there should be mention of function calls vs use of a component.
I am aware of #754 and that it wants to remove the warning again. I would argue that instead of the new
(when (reactive?))there should be anifwhere the else branch mentions function calls vs components. I am pretty certain it does not fix this case - it just moves the check forreactive?into the function that is called from the old check location.