Fork me on GitHub
#off-topic
<
2019-04-02
>
idiomancy12:04:12

hello, everyone, I'm here for my weekly blind rage at React.js for not supporting custom synthetic events! why oh why must clojurescript use react.

idiomancy12:04:13

oh, you want to use webcompponents that emit cusom events to compose pages? nope! sorry, react.js doesn't do synthetic events. oh! you want to do server side rendering by responding to turbolinks events to increase your SEO and make a lower friction path to migrating from vanilla JS? nope! sorry, React.js has not officially sanctioned that source of events, and new things scare us!

orestis13:04:08

FWIW, I think they are considering/working on a new Events API

orestis13:04:48

But, I didn’t know they didn’t support synthetic events. I’ve only used synthetic events once or twice, but never in a React context.

orestis13:04:07

Because they’re not really needed in most cases - you can just pass a callback in.

idiomancy13:04:28

yeah, i mean thats the thing. React is good for doing what javascript has done for the last 5 years better. But because it doesn't allow for synthetic events, its totally missing out on what javascript can do now. because react is no longer the only player in the game that has figured out how to do web programming correctly

idiomancy13:04:48

its like, blockchain events, turbolinks serverside rendering events, webcomponent events, appsync websocket events....

idiomancy13:04:15

all things that can basically totally flip web programming on its head, and react.js just wont hear it

idiomancy13:04:24

whereas Vue.js is just like "yeah man, chill chill chill. you throw whatever at us and we'll make it work"

Alex13:04:26

forgive my ignorance, but how does cljs force react?

idiomancy13:04:43

Well, there are two reasons. the first one is probably something that unless you've experienced it, it probably wont sound right - the cljs community is protective of react. all the github issues and discussions in the channels are like "the cljs community has settled on react and were going to move forward from there" which makes sense from a pure time management perspective..

idiomancy13:04:13

the second one, related to the first, is that all the good frameworks are based on react

thumbnail13:04:23

vue.js is a framework, right? wherease react is basically a render library

idiomancy13:04:44

vue is no more a framework than react

idiomancy13:04:42

in fact, I think react is considerably more of a framework, honestly. cljs has just wrapped it in such a way that it is useable as a render library

jaihindhreddy13:04:42

minor nitpick here: ClojureScript didn't choose React, in a way that it chose Google Closure. The ClojureScript community did seem to choose React, but that can be changed by anyone, by advocating other view libraries, by writing, using and/or maintaining libraries that choose something else, Vue, Lit-Element, you name it.

idiomancy13:04:34

Perhaps even by starting threads to generate conversation around the topic in clojurians 😉

😉 4
idiomancy13:04:53

but yeah, I think I'll probably start whittling away at some new tooling

👍 4
lilactown13:04:14

@idiomancy are you having issues using the custom webcomponent events / turbolinks events in general, or you wish you could use React’s event system to handle them?

idiomancy13:04:45

The latter. They can be cluged in, certainly

lilactown13:04:45

yeah. the problem is that React added some additional layers on top (their own “Synthetic event” system) of the DOM events to account for browser differences

lilactown13:04:52

which isn’t needed nearly as much anymore

lilactown13:04:25

it means that they have to anticipate the events people want to handle

lilactown13:04:03

for custom events, you have to do some raw DOM stuff. but at least you only have to do it once in a wrapper component

idiomancy14:04:56

hmm, I don't supposed you have a gist of that process do you? If you dont off hand, I can do the googling myself :D

lilactown14:04:56

for turbolinks, I bet there is already an example, even a lib out there for interop with React

idiomancy14:04:06

yep, you're probably right. thanks again, man!

orestis14:04:21

What are people using to test/monitor front-end performance? I want to capture/log (with high cardinality, if possible, a-la Honeycomb) how long do network requests take, how long do React renders take etc.

adamfeldman14:04:08

Check out http://logrocket.com. One of a spectrum of similar products

orestis14:04:59

Doh! I searched for honeycomb front end but didn’t get any relevant hits.

adamfeldman15:04:29

I've just started playing with Honeycomb myself (but not yet in Clojure). Also wanted to ensure you've seen https://github.com/conormcd/clj-honeycomb. I'd love to hear about your experience with the product, especially relative to the alternatives -- I mostly have experience only with Datadog

adamfeldman15:04:00

Since getting frontend data into Honeycomb requires rolling a bunch of stuff yourself, you may also consider this https://github.com/elastic/apm-agent-rum-js (or just using pieces of it if they're helpful). I haven't found any other free/open-source JS agents (I haven't yet done any of the above, but it's the plan 🙂)

gklijs15:04:47

I found etaoin very nice, not the full package, but makes it easy to wirte code that integrates with the browser.

butterguns16:04:28

Does anyone have any good resources on Git best-practices? Branch management, commit squashing, merge / rebase. Things to bring me up to date with the current thinking of how to best use Git as part of a team, with issue tracking etc.

idiomancy17:04:12

Git flow helps establish a pretty repeatable well understood pattern for collaborative git use @mattmorten

butterguns17:04:18

This looks like a great place to start. Thank you!

dominicm18:04:07

@mattmorten gitflow has come under a lot of criticism, I recommend https://hackernoon.com/how-the-creators-of-git-do-branches-e6fcc57270fb as a good read

Lennart Buit19:04:40

thats really cool! I end up with inter-dependent branches more than I like to admit, and I don’t seem to have a proper strategy to build a (new) feature on two different already-existing-but-not-yet-merged feature

gklijs20:04:55

You can start with a merge of those two. But your getting a lot of merge commits that way. I really would like to work a lot more with rebase, with everybody in it's own fork when you need to cooperate.

dominicm20:04:56

I think the article makes a good case for merge commits on master, I think I agree

Lennart Buit20:04:55

yeah, at work we squash-merge, that keeps the commit log on staging clean, but makes it quite difficult finding where a change originated from. E.g. “this fairly large feature branch”.

dominicm20:04:37

I don't agree with squash merge, because a commit history on a branch can be curated to tell a story. That's what I do.

dominicm20:04:19

But some people just do wip, wip, wip, and that isn't a useful history.

Lennart Buit20:04:26

I think we agree, I prefer ordinary merging as long as the commit log doesnt become wip

Lennart Buit20:04:31

we were typing the same

😆 4
Lennart Buit20:04:57

although I feel a bit offended by GHs tendency to show force pushes nowadays :’)

futuro02:04:25

I prefer leaving all branch commits as-is, then passing —first-parent to git log

futuro02:04:22

That way I get the clean high level view of the project history, but I can dig into a branch if I need a fine-grained look at a particular feature.

futuro02:04:13

This also allows me to merge master into a feature branch to resolve merge commits ahead of time, without risking gnarly destruction of the commit delta.

futuro02:04:17

Which, of course, as I start reading the linked article I see that’s mentioned :man-facepalming::skin-tone-2:

dominicm04:04:05

I rebase feature branches, and use rerere to prevent reconflicts

Lennart Buit05:04:20

The thing that I find most hard to deal with is having features 1.1 and 1.2 not merged (because waiting on a review), and then trying to work on 2.1 which depends on both 1.1 and 1.2

Lennart Buit05:04:49

I can rebase 2.1 on top of 1.1, but then I don’t have 1.2, or vice versa

Lennart Buit05:04:26

I can maintain an integration branch with both 1.1 and 1.2, and base 2.1 on top of that, but then my diffs in GH are all messed up

futuro11:04:24

What about creating 2.1 from the parent of 1.1 and 1.2, then merging them both into 2.1?

futuro12:04:03

So long as you don’t rebase 1.1 or 1.2, you can merge any updates to them into 2.1 just fine

Lennart Buit12:04:57

right, and if 1.1 and 1.2 get merged… wouldn’t you get like unneeded merge commits from 1.1 and 1.2 on the 2.1 branch that “contaminate” your history?

futuro17:04:55

I guess that depends on what you mean by “unneeded”.

futuro17:04:53

Same with “contaminated”.

futuro17:04:03

The only time I’ve experienced “commit contamination” was when someone took one branch and tried to turn it into multiple branches, rebasing and cherry-picking commits that were almost exactly the same but not quite.

futuro17:04:15

This made it exceedingly difficult to understand which commits were “the right ones”, since they had almost-but-not-quite the same content.

futuro17:04:23

I personally like merge commits, especially when they’re subject is more informative than “merging foo into bar”. Ideally, the merge commit will encapsulate why you’re merging. So at the beginning of a branch, it might be to say which work you’re basing off off. At the end of a branch, the merge commit between your topic and master/prod branch contains all of the information about what the topic branch does, and why you built that functionality.

futuro17:04:17

git log —first-parent, then, will only show these high-level commits, allowing you to gloss over the implementation details until you need them

futuro17:04:07

This helps with the day to day work, and also keeps potentially important information around if you ever have to dig into the nitty gritty of how/why particular pieces of code came about

dominicm20:04:09

The linked article above does mention dependencies

dominicm20:04:22

I need to play a little with it locally

Lennart Buit20:04:11

yeah — I am dragging this on, I find it very interesting tho, because now that I am actually developing full time (a year and a half out of university) I am stumbling upon this branch-dependency issue more often

Lennart Buit20:04:47

thanks for the input ^^!

💯 4
dominicm21:04:23

I'll likely be doing a deep evaluation tomorrow, so I'll try and remember to report back

dominicm09:04:40

It seems that git is smart enough to handle rebased branches as long as you merge other features with the --no-ff branch. When I didn't have a merge commit, git couldn't handle that.

dominicm09:04:53

I'm just writing up the repro now, it's a bit involved 🙂

dominicm09:04:29

# gitworkflow test

Attempts at documenting what happens when X happens.

## Setup

* `mkdir github`
* `cd github`
* `git init`
* `git commit --allow-empty -m 'Root commit'`
* `cd ../`
* `git clone github dmc`
* `git clone github mal`

## Scenario 1

What happens if you "depend" on a feature branch which is later rebased.

Steps to repro:

* cd `dmc`
* `git checkout -b featureA`
* `echo foo >> file && git add file && git commit -m 'wip: update file'`
* `echo bar >> file && git add file && git commit -m 'update file'`
* `git checkout -b featureB master`
* `git merge --no-ff featureA`
* `echo 'BBBB' >> file && git add file && git commit -m 'featureB'`
* `git checkout featureA`
* `git rebase -i HEAD~2` (fixup into the wip commit)
* `git checkout master`
* `git merge --no-ff featureA`

Actions:
* `git merge --no-ff featureB` => Success!

dominicm09:04:21

Reading through man gitworkflow seems to suggest you should never do a rebase on a branch which has downstream dependencies. Once a branch is on next, you must fix it with incremental patches, apparently 🙂

Lennart Buit19:04:42

oh cool, so as long as you always have merge commits (also if it could have been fast forwarded), rebasing on a topic branch that depends on another topic branch is not an issue

dominicm21:04:14

Looks like it, yeah

dominicm21:04:55

We are now rolling this approach out to client work :)

idiomancy18:04:52

yeah, I mean I wouldn't argue against a better solution than git flow, for sure

hipster coder19:04:10

I have come to decision today. To use Clojure 100%

hipster coder19:04:31

The culture of the community pushed me into the decision

👍 24
hipster coder19:04:55

I think the culture is more experienced in computer science

richiardiandrea19:04:47

on the other side, we got today a bit of a sad news...our R&D department is doing things in a too weird way (Clojure? Event Sourcing? What's that)

richiardiandrea19:04:58

dunno what's going to be of our project 😞

😭 8
richiardiandrea19:04:49

I guess there are both sides of the coin to niche ... sometimes for some management it just does not click

gklijs20:04:44

We are going to have something for charts, and need them in the front end the back-end. Might want to push Clojure for it.. It's really Java heavy though and they are al scared of things like GraphQL and event sourcing.. And that are just the developers, the architects haven't even heard about those things, well at least not about Clojure..

richiardiandrea20:04:08

I found developers here don't get this - in my case I am part of the Architect team 😄

gklijs21:04:33

In that case you can just tell them to use those right? Maybe help them a little with a poc? We are working together to plan the next steps. But with both the other developers and the architects being rather stuck on 'proven' technology I don't have high hopes.

richiardiandrea22:04:12

oh man that's so true, we have a fully fledged MVP done here (no POC anymore, already done that) and still people don't "trust" us...oh well I am venting out now 😉