This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-12
Channels
- # aleph (10)
- # beginners (62)
- # boot (12)
- # cider (97)
- # cljs-dev (171)
- # clojars (1)
- # clojure (224)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-russia (1)
- # clojure-spec (41)
- # clojure-uk (68)
- # clojured (7)
- # clojurescript (115)
- # community-development (4)
- # cursive (2)
- # data-science (1)
- # datomic (18)
- # duct (40)
- # emacs (1)
- # events (1)
- # fulcro (148)
- # funcool (2)
- # graphql (2)
- # immutant (3)
- # jobs (3)
- # keechma (1)
- # luminus (2)
- # numerical-computing (1)
- # off-topic (19)
- # om (6)
- # parinfer (10)
- # pedestal (15)
- # precept (86)
- # reagent (12)
- # ring (3)
- # ring-swagger (2)
- # shadow-cljs (42)
- # spacemacs (19)
- # specter (17)
- # sql (11)
- # tools-deps (78)
- # unrepl (62)
- # vim (28)
@magra refreshes are based on queries, not what is in the db. Also, for a refresh to work, there has to be something to refresh…if the thing is just coming onto the screen then it won’t be in an index yet. You’ll need to trigger a refresh on the query above it.
@tony.kay fulcro 2.3.2, fulcro-spec 2.0.3-1
Refresh rules are very simple: 1. The component that ran the tx refreshes. 2. Any on-screen component that queries for a kw you’ve indicated a refresh on will refresh (but this is refresh, so you’d want to hit the parent for a new item).
@levitanong version of clj/cljs?
1.9.946
strange. The assertions block and throws arrow just translate to underlying clojure test stuff. The symbol it is complaining about is one defined by those lower-level libs, which should be included when you pull in fulcro-spec.core
Hmm. Also, I got Wrong number of args (1) passed to cljs.core/ExceptionInfo
with a :regex
key, I think, and a regex (that’ll let you match against the exceptions message)
That got rid of the wrong args warning, but the undeclared var of throws?
still happens
Use of undeclared Var my-project.util-spec/throws?
the error message tells me that the assertions
macro generates throws?
but in my own namespace instead of the clojure.test ns
at least i think that’s what it means
perhaps there is a problem if you’re just using cljs, and it doesn’t pull in the macros (which are clj)
ah, i had thought about this, so i changed the require statement to go :include-macros true
but still no dice
also i’m on cljc. haha
this is the code in spec itself (a cljs file):
(ns fulcro-spec.assertions-spec
(:require [fulcro-spec.core :refer [specification assertions]]))
(specification "assertions blocks work on cljs"
(assertions
"throws arrow can catch"
(assert false "foobar") =throws=> (js/Error #"ooba")
"throws arrow can catch js/Objects"
(throw #js {}) =throws=> (js/Object)))
how perplexing.
i’m looking through the clojure.test api, i don’t see a throws?
not in the clojure.core namespace either.
the version i’m using is 2.2.6
ok, there was a problem with shadow-cljs giving an invalid warning on spec, now that I think about it
I had to rewrite something in spec to fix that...I don't remember what, but if you're using the latest version I would have expected it to work 😕
well, it could still be an unrelated problem
no, see there is some code to add addl support to the clojure.test
is
expression internally
ooooooooh
and what it was doing was a case
against some symbols, if I remember right...and that was screwing up so I changed it to a cond
, and I thought that fixed it
this was the commit https://github.com/fulcrologic/fulcro-spec/commit/402644f7fff0172462cceddc8c0576f734b4f104
perhaps the problem is in the symbol being interpreted as a var rather than as a symbol
well, it is obviously different between it and standard cljs, cause it works on the standard compiler 🙂
I had a difference between the main cljs compiler and shadow. Fixed in that line 88 reference above. Using symbols in a case statement wasn't working for me in shadow, so I changed it to a cond. That seemed to fix it for me, but @levitanong is reporting he's having similar problems still.
i’ll try to repro off a new template
the commit you linked has a lot of whitespace changes. hard to figure out what you actually changed
when using the case, shadow was resolving the symbol in the user's ns, instead of as a raw symbol
yup it’s happening. on a fresh fulcro shadow-cljs template, adding this triple: (throw #js {}) =throws=> (js/Object)
causes
8 | (assertions
-----------^--------------------------------------------------------------------
Use of undeclared Var test-repro.sample-spec/throws?
--------------------------------------------------------------------------------
9 | "with positive integers"
10 | (+ 1 5 3) => 9
11 | "with negative integers"
12 | (+ -1 -3 -5) => -9
--------------------------------------------------------------------------------
and when you look at your resolved deps, you're actually getting the latest spec, right?
fulcro-spec
defines it's own I think. I didn't write a lot of that code, so I'm not for certain 😜
@tony.kay yeah, on lein deps :tree
, it’s showing i have 2.0.3-1
The reproduction of the problem, which only happens on shadow, is:
1. lein new fulcro app
2. shadow-cljs watch test
3. Edit the sample spec, and add to the assertions block:
(assertions
"some test of throw"
(throw #js {}) =throws=> (js/Object))
I'm going to head to bed. Thanks for checking in @thheller 🙂 If you see something that is technically wrong in fulcro-spec and just accidentally works in the standard compiler, Iet me know.
thanks also guys. have a good night, @tony.kay!
(ns app.sample-spec
(:require
[fulcro-spec.core :refer [specification provided behavior assertions]]))
; Tests for both client and server
(specification "Sample Spec"
(behavior "addition computes addition correctly"
(assertions
"some test of throw"
(throw #js {}) =throws=> (js/Object)
"with positive integers"
(+ 1 5 3) => 9
"with negative integers"
(+ -1 -3 -5) => -9
"with a mix of signed integers"
(+ +5 -3) => 2)))
i don’t understand the question haha
i have a hunch
hang on
cached builds?
you mean to say lein clean
should fix it?
well, deleting the cache worked for me. @_@
it’s weird, the problem was happening on a repro project that i had started up but didn’t do anything with
or rather, the problem was happening on my work project, i reproduced the problem on a repro project i spawned a couple of days ago but didn’t do anything with
but couldn’t reproduce it on a fresh template
Yay I'm not crazy
I suspect its this one https://dev.clojure.org/jira/browse/CLJS-2417
caching is already pretty defensive and pretty much always invalidates whenever anything changes
lol it came back
but again, i can’t repro. What happened when it happen was:
1. I restarted my computer
2. I ran lein repl
, showing some error message because i had forgotten a require. After fixing it, i ran shadow-cljs watch test
, then the problem happened.
3. had to clear the cache before it started working again.
I restarted again, tried shadow-cljs watch test
and the problem didn’t show up anymore.
Anyone know why shadow-cljs and fulcro-spec give me these errors which will only go away after blowing away all shadow-cljs state:
------ WARNING #1 --------------------------------------------------------------
File: /home/mitchel/Development/atlas-crm-next/test/atlas_crm/ui/components/entity_selector_test.cljc:38:8
--------------------------------------------------------------------------------
35 | (let [result (run-mutation {:state temp-idents-state
36 | :mutation-key `entity-selector/close-autocomplete
37 | :ref ident})]
38 | (assertions
--------------^-----------------------------------------------------------------
Use of undeclared Var atlas-crm.ui.components.entity-selector-test/exec
--------------------------------------------------------------------------------
39 | "Temp data is gone"
40 | (get-in result [:item/by-id 99]) => nil
41 | "Other results still exist"
42 | result =fn=> (*contains? {:item/by-id {1 {}
--------------------------------------------------------------------------------
@mitchelkuijpers trying to figure that out. proving really hard to reliable reproduce
hi all, walkable[1] now support many dbms by specifying quote marks eg "\"" for postgres, "`" for mysql
latest version (1.0.0-SNAPSHOT) is on clojars
your feedback is most welcome
@tony.kay Thank you. I tried again the whole day. I must be missing something basic. Not even :render-mode :brutal works. (:render-mode (:config (:reconciler @inserate.client/app)))
returns :brutal
so I should have hit the right switch, right? All adding to existing lists and children and editing works. But adding a first child-item just adds to the db, not to the screen. Did I block an internal mechanism or am I just barking up the wrong tree? Any ideas, what I might be missing?
I followed your example of the top-router and report-router. What would be the syntax to force the report-router to pick up changes in the db?
@tony.kay so I identified the fulcro-spec issue. the issue is that the macro does a side-effect on the CLJ side. when the CLJS is cached only the CLJ side of the macro is executed but the macro itself is not called. I would recommend rewriting the macro without all the if-cljs
and just always do the clojure.test/assert-expr
AND cljs.test/assert-expr
defmethods
you could probably just do the defmethod
inside a :clj
read-cond entirely without a macro
@thheller ooof. OK, I’ve been seriously thinking about rewriting the whole thing. I wrote the original outline, but it was put together from there by others, so I’m not too familiar with the code base. Thanks for looking at it. Sorry it sucked up so much of your time!
I think this will also break without shadow-cljs because they also want to build more caching inside clojurescript
it should already break if you have :cache-analysis true
enabled but yes even more of a problem for the newer shared AOT cache
if that is ever going to work in the first place. I tried that for shadow-cljs but quickly backed out of it. cache between builds is just a nightmare to invalidate
@magra The refresh story has been around for years, so if you can put up an repro case I can look at it. If you’re doing keyframe and it isn’t working, then your state isn’t right to begin with.
chances are your navigate away and back is doing something subtle to the app state that is fixing it
@mitchelkuijpers @thheller so, all the more reason to clean it up now
@thheller The problem is the multimethod in cljs has a different signature than the one in clj 😕
so you have to define the multimethod differently dependning on which context you’re in…I think I might have to rewrite it not to use that multimethod at all
just (do (defmethod clojure.test/assert-expr '= [msg form] ...) (defmethod cljs.test/assert-expr '= [menv msg form] ...))
I think making a separated multi-method makes it easier to understand, mixing arities depending on clj/cljs seems like a mind bugger
agreed, and that's even more reason to avoid doing extra complications that can be avoided
@levitanong try 2.0.4-SNAPSHOT of fulcro-spec. I think that fixes it
@magra :keyframe
would be the one you want to try not :brutal
. Also with your example before you had (:company/_offices params)
to get the id part of an Ident, which looked odd to me.