This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (1)
- # aws (2)
- # beginners (43)
- # calva (7)
- # cider (5)
- # cljs-dev (1)
- # cljsrn (2)
- # clojure (68)
- # clojure-android (10)
- # clojure-conj (2)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-spec (3)
- # clojure-uk (128)
- # clojurescript (10)
- # core-async (47)
- # cursive (32)
- # datomic (35)
- # events (1)
- # fulcro (24)
- # funcool (2)
- # graphql (2)
- # jobs (3)
- # juxt (2)
- # leiningen (3)
- # luminus (1)
- # off-topic (7)
- # om (1)
- # onyx (2)
- # pedestal (32)
- # perun (2)
- # portkey (2)
- # re-frame (4)
- # ring-swagger (2)
- # rum (3)
- # shadow-cljs (137)
- # spacemacs (4)
- # testing (3)
- # tools-deps (101)
- # uncomplicate (2)
- # unrepl (5)
- # vim (2)
Is there an idiomatic way to do dynamic queries with a
I understand that the right way to do dynamic queries is to use a factory with a qualifier, rather than a component. AFAIK, defrouter works exclusively with components.
@levitanong Did you take a look at http://book.fulcrologic.com/#_code_splitting_modules ?
@claudiu i have, but it’s a slightly different use case.
Consider a component
Org, which contains a list of both
:org/brands. I have a tab which switches between showing campaigns and brands.
Originally I wanted to put both campaigns and brands in separate routes, but because they’re properties of an entity, it’s difficult/impossible to come up with some sane way to
ident the components to route to
So I figured I should use
set-query!. Clicking on the
campaigns tab sets the query to ask for
hmmm, I used the dynamic one just because I wanted code splitting. Can't you get what you want by nesting two
defrouters. One for the page screen and another one for the tab view ?
That said, it seems to work if I don’t add a
:qualifier, but I’m not sure that’s safe
I use showdown js package from http://cljsjs.github.io/ , but when i change my input on text area, the markdown won't change.
Also, understand that the defrouter is both an optimization and an implementation...it uses union queries, which makes your app faster. In some cases it makes perfect sense to just code a component that has a normal queury, and "routes" via if-like logic
they query will be a little more overhead that way, but in some cases that will be fine and the logic will be easier...I lean towards that before a dynamic query, personally
but the dynamic query case is good if you have large queries under each possible "route"
@tony.kay Oh, great! Glad to know about the singleton bit. That makes sense. As a learning exercise, I’ll use the dynamic queries (I have the leeway to do this since i’m writing a small internal application) and if i run into trouble, I’ll go with the normal query with conditionals 🙂 Thanks for the help!
the problem is react re-render is not being triggered, and that only happens when app state (and query data change)
Is there a way to run a mutation, of change the state directly, after a
nav-to! call as implemented in the fulcro template? I’m trying to avoid flickering of the UI upon visiting a non-login route
@pvillegas12 i believe all the routing mutations have helper functions that can be composed into one of your mutations, so then all changes happen atomically in one mutation, that should avoid flicker