This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-13
Channels
- # admin-announcements (1)
- # beginners (10)
- # boot (15)
- # cider (9)
- # clara (195)
- # cljsrn (24)
- # clojars (20)
- # clojure (46)
- # clojure-android (1)
- # clojure-germany (15)
- # clojure-greece (16)
- # clojure-nl (1)
- # clojure-russia (13)
- # clojure-spec (28)
- # clojure-uk (44)
- # clojurescript (104)
- # clojurex (1)
- # component (7)
- # css (2)
- # cursive (27)
- # datomic (92)
- # dirac (12)
- # emacs (5)
- # lambdaisland (3)
- # lein-figwheel (36)
- # mount (87)
- # off-topic (8)
- # om (102)
- # om-next (3)
- # onyx (30)
- # pedestal (3)
- # re-frame (26)
- # reagent (20)
- # robots (4)
- # specter (18)
- # spirituality-ethics (1)
- # untangled (127)
- # yada (11)
Hello. First of all, I would like to thank everyone for making this awesome framework available. I’m currently prototyping an app for a startup and committed to using untangled for our project. For past few days, I’ve been stuck with getting the nested tab interface working. I using the tabbed-interface cookbook recipe and trying to embedded another tabs component in the one of the tab. The query returns the following data Root {:current-tab {:which-tab :main, :main-content Main tab, :current-inner-tab {}}}
. What I’m expecting is that the :current-inner-tab
will be populated with the inner tab union component query and it’s not working. Here is the gist for it https://gist.github.com/jichon/1bf901b95a9d0562900e816ce4cd95f7. Help would be greatly appreciated. Thank you.
Would you describe your problem as when switching from one tab to another you want the panel below the tab to show?
In the cookbook recipe it just loads data from some URL iirc. Instead you want to show a local component that is backed by local data?
When I switch b/w the top level tabs I’m getting Root {:current-tab {:which-tab :main, :main-content Main tab, :current-inner-tab {:tab-data-query {:text This is a value from the server}}}}
and inner tabs are not getting rendered
I found that I needed to have a mutation that gets called whenever the user changes tabs. This mutation changes app state so that what is supposed to be under the tab is in fact there.
I was thinking of submitting a cookbook recipe request for this, as it wasn't that easy to work out in the first place.
that would be awesome. I’m a noobie to om.next and untangled. If you have time to provide that that would be really helpful
sweet. I’ve should of talk to you guys when I had this issue. I’ve spent few days chasing a wild goose 😃
I'm not sure this will help. A proper cookbook thing will be a lot better and a lot simpler. st/GasQueryGrid
- that's actually a number!
This is how it is called: `(defn change-tab-mutation [component which-tab-kw]
(om/transact! component [(nav/load-tab {:target ~which-tab-kw})]))
I guess with this approach, it can’t utilize the union query to have the inner tabs component decide which to render based on the ident
@tony.kay: passing the same parameter twice doesn't get the output I was looking for. I guess om works like this intentially, but i was expecting the last example to work by giving output
[{:foo 3}]
, example set ;; singletons work whether ident or not
(om/db->tree `[:foo] [:link 1] {:link {1 {:foo 3}}}) => {:foo 3}
(om/db->tree `[:foo] {:foo 3} {}) => {:foo 3}
;; lists work only in ident
(om/db->tree `[:foo] [[:link 1]] {:link {1 {:foo 3}}}) => [{:foo 3}]
(om/db->tree `[:foo] [{:foo 3}] {}) => [{}]
oh, I think there is an open issue in Om that data must be normalized for this query to work right...
Yeah, it is sometimes hard to tell, because the Om docs don't explicitly say what they should do in all cases
@jasonjckn: actually the docs are clear for db->tree
"Given a query, some data in the default database format, and the entire
application state in the default database format, return the tree where all
ident links have been replaced with their original node values.”
it does mention the default database format twice 🙂
we opened that issue exclusively for tracking
It’s not clear if that’s going to be fixed or not
or if it even deserves to be fixed
@anmonteiro: it is an interesting question. The default database format does not require that everything be normalized, per se
yeah, that’s why we opened the issue
i think my 4 examples illustrate that you already support unnormalized singletons and I see a lot of om.next code using singletons
it’s also not clear if:
1) we should support both cases in db->tree
2) that we can even distinguish between them
@jasonjckn: but singletons are already normalized 🙂
because there’s only one of them
@tony.kay: the question is also one of performance
my use case is a subquery that's passed onto the remote backend, `[{:search-results [:name :address]}] i don't want to normalize the search results because they're so ephemeral and giving identity to a particular search result is difficult
so I could have an opaque query `[:search-results] but I wanted to communicate to the backend what data I needed
if we allow for state not to be fully normalized, then people won’t bother normalizing and apps will be slow as hell
@jasonjckn: do you even need to call db->tree
then?
ah, but optimization should be something they can do...not something we enforce. It doesn't affect correctness
@anmonteiro: i'm using untangled so I can't write a read parser
I'm not even sure I agree with your assessment that they'd be slow. why would that be? It is still just map traversal
they would often be incorrect, in that if you leave it as a tree, you cannot share data across the UI
but that would be a self-correcting problem: they would normalize it to get it to work
traversing idents seems technically the slower route to me (it adds one more loop to the recursion, along with conditional logic to find out if there is an ident)
on mutations: ok, maybe you're mucking with a deeper data structure, but those happen on a low-frequency time-scale in general, and updating a tree really isn't that much different on these small operations. So, again, I can argue you want normalization for correctness and ease of re-rendering shared data...but I have trouble seeing why we care if they choose to leave some blob of unshared data denormalized.
yeah, not seeing the reason...other than the case you mentioned of not being able to detect if a 2-tuple vector is an ident...that is a challenge...or is that even the case that's hard?
where can one have a vector that contains a keyword but is not an ident in the db format? Oh, I guess if it is a blob of data, you might have a vector of keywords...if you tried to query that it could cause a problem.
which then begs the question if idents themselves shouldn't at least have metadata markers on them
The db normalization process could just mark the idents it places in app state with metadata during the normalize process.
so that vectors that represent idents are marked as they're placed in the db. Nothing changes in the public API at all.
all internal, no API changes. Anyone hand-normalizing initial state would have to hand-mark idents
but as I've recently shown with Untangled's Constructor addition, this should never be necessary
I was trying to see if @anmonteiro wanted to discuss it more here...my intention is to see if I'm missing something before adding to the issue
I seem to even remember earlier versions of db->tree
working in this case...I think it regressed at some point due to other additions or expansions/realizations.
I wrote the original tutorial, and I know it used to work for the non-normalized data.
@tony.kay: not sure if it was ever supported
re: slow apps, the problem is if you don’t normalize you lose the ability to do incremental queries
Oh, I agree it may not have been intended...just saying it was confusing because it did work that way for a while
not only path optimization
also calling db->tree
with an ident
that’s also an example of a query running incrementally
Sure, I agree...but where are the definitions of "slow"? We talking s, ms, micro, nano? If I happen to leave a single blob somewhere for convenience and want to query into it, and the rest of my db is normalized, does it really hurt anything? If my app is slow because I make such a choice, then it seems I have the power to correct it. Why narrow the ability of the API?
@tony.kay: yea, we should probably do more work on it
TBH I’m not a fan of metadata in idents
related to this discussion: https://github.com/omcljs/om/issues/637
but it seems like the only solution is to mark these things somehow...either metadata or a new type...both are going to break existing apps.
definitely not a fan of adding more syntax
@tony.kay: not sure if it’s even needed
I think it’s probably just a problem that needs to be looked at again
definitely not something like (Ident. …)
that wouldn’t be data, and queries need to be data
if the database format only limits itself to 2-3 types [] {} etc, there's only so much you can represent with this without having to start conflating different things
@anmonteiro: perhaps checking to see if the thing that looks like an ident resolves to nil?
look at that, that might just work!
or maybe even better...only consider it an ident if the keyword resolves to an existing table
see, several ideas, we just need to keep thinking about it 🙂
that wouldn’t even need new metadata etc
I’m happy to work on a patch for that if you don’t have time
once we figure out a sound design
in fact....gotta go. Let me know if I can help on decisions related to db->tree
...I'll respond later
I'm working on a bare bones untangled server instance to learn how it's put together. I'm not requiring taoensso.timbre
anywhere in the code, so I don't have it in my project dependencies. When starting up lein repl
, I get the following error:
> lein repl
Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
Caused by: java.io.FileNotFoundException: Could not locate io/aviso/exception__init.class or io/aviso/exception.clj on classpath., compiling:(taoensso/timbre.clj:1:1)
When I add com.taoensso/timbre
as a dependency, the error goes away. I can run lein repl
and start the server just fine. I see that navis/untangled-server
(included in my project) includes com.taonesso/timbre
as a dependency, so I'm confused as to why I'm seeing this error@tony.kay: happy to see what we discussed captured in the issue
@anmonteiro: I can write that up later
no rush, thx
@jasonjckn: welcome