-
-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoke 'after' and 'enrich' interceptors only when context contains effects db. [fixes #447] #450
Conversation
test/re_frame/interceptor_test.cljs
Outdated
|
||
(deftest test-enrich | ||
(testing "when no db effect is returned" | ||
(let [ctx (context [] [] {:a 1})] | ||
(is (= ::not-found (get-effect ctx :db ::not-found))) | ||
(-> ctx (:after (enrich (fn [db] (is (= db {:a 1}))))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the bad test I mentioned. It was looking inside 'ctx' for an ':after' key, and returning a function that was never invoked as a not-found value. This is fixed now.
@zacharycurry I appreciate you jumping in and helping, thanks. And I also appreciate the completeness of your PR (ie. including tests and an update But I'm thinking that both Justification ... Example
Example
|
Thanks @mike-thompson-day8! I read the bugs description a tad too prescriptively and didn't think about what I was doing. Whoops! What you've said makes total sense. I'll fix this up real quick... |
If I understood you correctly @mike-thompson-day8 this PR should be exhibiting the desired behavior now. If you see anything else gone awry, let me know, I'll jump in there and fix it up :) I'm new to open source dev, so if I do anything silly, or my PR is whack, please let me know so I can scrub some of this newb-smell off me ;) |
I’ll take a look at this and compare to what I’ve done on re-frame-trace on Monday. |
@danielcompton will leave this for you to merge (or not) and to then close #447 |
Hi @danielcompton ! I just heard you on the defn podcast. What a small world! |
Thank you for helping me out with this @mike-thompson-day8 ! I really appreciate it! Forgive me for asking the following newbie questions:
I have merged master into my branch, is that what you mean? I don't think I have permissions to merge this to master myself (or do I?).
I don't think I have the permissions to close issues in this project (or do I?). |
Thanks for your help here @zachcurry! I'll come back to the enrich test. I've opened #453 to discuss changing the behaviour of after and enrich, as it's a breaking API change. |
I thought I'd grab a ticket and give you a hand! See bug for context 447
I noticed that 'after' and 'enrich' both suffer from this issue, so I fixed them both with as little change as possible (no refactoring).
With regard to the tests, I wrote failing tests for each function, and each case, and they failed. After making them pass I noticed there was an error in an existing test case within 'test-enrich' such that it was not actually testing anything, so I fixed it as well! You will find a comment in the review highlighting this issue.
I made reference to my fix in CHANGES.md as per the contributing instructions. If that's not how it should be done, let me know and I'll fix/remove it.