Fork me on GitHub
#reitit
<
2019-04-03
>
orestis10:04:25

I’m having a lot of nested routes. The Match gives me the last one. Is there a way I could also get grab of the parent ones as well?

orestis10:04:20

Use case is: I have a sidebar navigation. I want the “list” element to be highlighted when I a “child” route is activated.

orestis10:04:46

["/messages"
 {:data "..."}
 [""
  {:name :message-list}]
 ["/:message-id"
  {:name :message-detail}]]

orestis10:04:26

So if my URL is “/messages/abc”, I’d like somehow to get [:message-list :message-id] from reitit.

ikitommi11:04:28

@orestis currently the info is not available, but the fragments could be pushed into Match. Per today, you can have an extra key like :section which is a set/vector. Meta-merge accumulates those normally.

orestis11:04:36

Right, so instead of relying on :name which is special for reitit, I should use my own :section to do any kind of matching I want

orestis11:04:00

(I use this feature for breadcrumbs, :crumbs is a vector which naturally accumulates down — cool stuff!)

ikitommi11:04:41

Please write an issue about the fragments in a match if you need that too

orestis11:04:51

Oh, BTW, is it expected that reitit is JVM-11 only? I got a surprise when Trie complained about not being compatible with my current JVM version. Especially since I’m only using it for CLJS 🙂

ikitommi11:04:31

0.3.1 should work with java8 too, my bad for compiling locally with java11

orestis11:04:42

Oh, new version. Cool!

orestis11:04:02

No problem, now our designer also has JVM11 which should be faster to startup anyway 🙂