Fork me on GitHub
#clojurescript
<
2017-01-01
>
kenrestivo02:01:49

you should never feel bad about code when you're just learning

fellshard05:01:18

Rather, you should never feel like the code you write makes you an abomination unworthy of ever handling code again. Bad code makes you feel pain that encourages you to write better code. 🙂

slipset20:01:20

I might just be asking the wrong question, but still

slipset20:01:17

We have an Om-app where we use secretary and google history

slipset20:01:52

The app was written before my time, but anyways, we seem to be updating the state both from listening to changes to the history (eg user writes a url) and by updating the state atom.

slipset20:01:00

What I’d like to achieve was while the user interacted with the application, the url of the app was a function of the state, but when the user manipulated the url, the state was updated to reflect this.

slipset20:01:37

As the app is right now, once the app updates the history, we get an event from goog.history, which updates the state.

slipset20:01:55

This seems a bit un-clean to me, but I haven’t seen a way around this yet.

slipset20:01:02

Anyone with the same problem?

emccue21:01:19

Is this causing any issues with maintenance or adding new things? If not I don't see how this is an issue. In my head, while view=f(state), the URL is under the same category as browser cookies and buttons on the page "the outside." That is, I think it's fine for History changed to make an event that changes state as well as state to update the history in the same way.

slipset21:01:45

Yes, looking into it, it might not be as bad as I first thought.

notanon21:01:49

agree with emccue, it makes sense for the relationship to be two way, both you (the code) and the user (url bar) can update the location

emccue22:01:58

Is anyone aware of what I should add to a project.clj to prepend a js file to my build automatically

notanon22:01:37

just include it, un-google-closure-fied?

notanon22:01:00

or do you want it tree-shake, advanced compile along with the rest of your cljs->js code

emccue22:01:36

Un-google-closure-fied for now; I'm sure the other option will get better soon enough

juhoteperi22:01:15

@emccue If Cljs wiki is up-to-date, :preamble doesn't work with :none optimizations, but you can use :foreign-libs: https://github.com/clojure/clojurescript/wiki/Compiler-Options#foreign-libs (same as used by Cljsjs libs etc.)

qqq23:01:07

when building a webapp where the client side is complicated (using cljs + re-frame), and the server side is dead simple (just a wrapper in front of aws databases), is there any preference for using elixir vs clojure vs anything else on the server side? [this is deploying to aws]