keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
sooheon 2018-01-11T04:21:34.000102Z

@mihaelkonjevic I’m looking for the idiomatic way to encode params in URL. How does this look for an on-click handler?

#(ui/redirect
  ctx
  (merge (:data @(ui/current-route ctx))
         {:dates %2}))

mihaelkonjevic 2018-01-11T07:12:00.000161Z

Good, that’s how it was meant to be used. If you have a link element you can use ui/url which will return the string that can be used as the href attribute

sooheon 2018-01-11T07:13:55.000254Z

Yep. And I noticed there is also a pipeline/redirect!--you thought of everything :)

sooheon 2018-01-11T07:15:11.000183Z

About ui/url: if I’m using the :history router, [:a] links cause a full-on reload. I know libs like accountant (https://github.com/venantius/accountant) short circuit this reload for you--are you thinking of adding something like this to keechma?

mihaelkonjevic 2018-01-11T07:27:33.000102Z

Hm, that should be short circuited. History router should add another component around the whole app which catches the clicks. I’ll check today if something broke

mihaelkonjevic 2018-01-11T07:52:58.000127Z

@sooheon If you pull and run this example https://github.com/keechma/example-color-panels do you also see the bug where history router causes page reload? I’ve just tried it and it seems to be working correctly for me

sooheon 2018-01-11T07:57:26.000080Z

That example works fine. But the links are only for route param color (i.e. they are after the ?). The links I have are route level links (just after /, before params).

mihaelkonjevic 2018-01-11T08:06:11.000254Z

That shouldn’t matter, so it might be a bug. I’ll double check today and let you know

sooheon 2018-01-11T08:07:31.000035Z

OK. I can kind-of reproduce it if I add routes key in history-app-definition: :routes [":page"] and another link: [:a {:href (ui/url ctx {:page "foobar"})} "Will Reload"]

sooheon 2018-01-11T08:07:51.000236Z

It appears to work, but after a bit of clicking around it reloads and shows the figwheel error page

sooheon 2018-01-11T08:10:04.000293Z

Definitely weird, it might just have to do with how I set up my app.

sooheon 2018-01-11T08:10:23.000050Z

I could put it up on github if you have the time to look at it?

mihaelkonjevic 2018-01-11T08:13:47.000140Z

Yes, please do

sooheon 2018-01-11T08:14:47.000323Z

ok will ping once I do so

sooheon 2018-01-11T08:28:43.000472Z

https://github.com/DMK-Labs/trendtracker

sooheon 2018-01-11T09:06:16.000182Z

@mihaelkonjevic please take a look at the app when you can :)

mjmeintjes 2018-01-11T10:00:17.000340Z

@mihaelkonjevic I was just about to ask for the ability to modify the route before passing it to params functions, but looking at the commit history I see you just added that - route processors. Thanks for that.

mihaelkonjevic 2018-01-11T10:01:16.000159Z

@mjmeintjes yes, I’m not sure if it’s released yet. I can push a new release today if needed

mjmeintjes 2018-01-11T10:02:36.000314Z

It's not urgent, but I've noticed that a lot of my code is basically just pulling out specific data from the route. I currently have a route namespace with functions for doing that, but having the route pre-processed will clean it up a lot. However I probably won't work on that in the next week or so, so no rush.

mjmeintjes 2018-01-11T10:05:23.000111Z

I'm working on a new project that will require server side rendering. I noticed that there is an example using Macchiato. Have you used Macchiato in production yet? I'm trying to figure out if it is stable enough to use in a real world app.

mihaelkonjevic 2018-01-11T10:12:41.000357Z

We had an rnd project built with macchiato and I didn’t have any problems with it. In my company we’re using elixir on backend so we don’t have any real production experience with it

👍 1
sooheon 2018-01-11T10:27:59.000312Z

@mihaelkonjevic I have a question about routing and dataloader. I think of the route as the entrypoint to the app state, so I hooked up a date-range filter in my dashboard to the route (it would put ?dates=2017-01-01,2018-01-01 or something). This allows me to declaratively load data with the dataloader, but it also causes a lot of extra navigation when I press the back button. Rather than going to the last page, it just goes to the last set of params. Is there a way to “squish together” all navigations where only the params have changed, not the route?

mihaelkonjevic 2018-01-11T10:47:35.000041Z

@sooheon no, not really. It might be possible (but I’d have to implement it) with the history router, but not with the hashchange one. You could also store those filters in app db instead of the url and then manually retrigger the dataloader. I can make you an example of that if you’re interested

sooheon 2018-01-11T10:48:36.000493Z

Yes I am interested. I’m trying that method now, and I’m getting mixed up in when dataloaders/controllers retrigger/clean-up data.

mihaelkonjevic 2018-01-11T10:49:10.000316Z

I’ll make you an example in an hour or so

sooheon 2018-01-11T10:49:16.000423Z

Thank you!

mihaelkonjevic 2018-01-11T11:40:25.000441Z

You can manually call (dataloader-controller/run-dataloader!) function from a pipeline after you manually set the value of a datasource

mihaelkonjevic 2018-01-11T11:40:53.000266Z

The whole idea of dataloader is that it helps you when possible, but leaves you in control for cases that are not covered by the dataloader