rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
2020-04-23T09:06:20.027400Z

@cjsauer To be precise about that, since we are aligning with React itself in this regard you'll still get stuff like this https://codesandbox.io/s/silly-faraday-mb94d?file=/src/App.js

cjsauer 2020-04-23T13:56:36.031400Z

@roman01la are you referring to the use of hooks? Scanning thru the PR. I’m noticing the use of rum/use-state in the examples, which I honestly had no idea even existed! I opened up a PR adding descriptions of those wrappers to the readme: https://github.com/tonsky/rum/pull/209 I also see you’ve implemented request-render in terms of .setState. Does Rum actually make use of (.-state component), or does this simply “trick” React into scheduling a render?

2020-04-23T13:57:17.032100Z

no not hooks, but how the caret jumps to the end of input in that example

cjsauer 2020-04-23T13:57:46.032400Z

Ahh yea, I see now. I opened on mobile initially.

cjsauer 2020-04-23T13:58:46.032900Z

I’ve had this issue in the past. Will be great not to worry anymore.

2020-04-23T13:59:14.033400Z

well this one in particular is just the way how inputs work on the web

2020-04-23T13:59:56.034300Z

but issues like skipped characters or jumping caret when typing in text won't be a thing in rum anymore when we merge that pr

cjsauer 2020-04-23T14:00:07.034600Z

> you’ll still get stuff like this Ah I misread. I see what you meant now.

2020-04-23T14:27:04.036300Z

> I also see you’ve implemented request-render in terms of .setState. Does Rum actually make use of (.-state component), or does this simply “trick” React into scheduling a render? That's just to schedule an update, yes. We might change this a bit in future, but the idea is that we should schedule updates using React's usual mechanism.

2020-04-23T14:28:08.036800Z

> Scanning thru the PR. I’m noticing the use of rum/use-state in the examples, which I honestly had no idea even existed! I opened up a PR adding descriptions of those wrappers to the readme: https://github.com/tonsky/rum/pull/209 Thanks. I'll merge this after https://github.com/tonsky/rum/pull/205

👍 1
2020-04-23T14:30:15.038100Z

There's a high possibility that Rum could easily adopt Hooks and Suspense w/o breaking existing users, which is exciting

2020-04-23T14:31:57.038900Z

I've already added Suspense component and lazy loading support for code-splitted components

Aron 2020-04-23T14:50:03.039300Z

I have not been able to rationalize suspense so far

Aron 2020-04-23T14:50:30.039800Z

and I am saying this as someone who has been using concurrent rendering since like 2016

Aron 2020-04-23T14:51:46.040700Z

and hooks are the best thing that happened to react, imho, but I still don't like using functions that are effectively Views, to manage state

2020-04-23T15:02:45.042Z

Yeah React gets complex and I'm not sure I like this, it becomes harder and harder to integrate with it

Aron 2020-04-23T15:03:35.042800Z

Afaik, calling in concurrent mode render on the root node with a full state is not different from just calling this.setState

Aron 2020-04-23T15:03:43.043100Z

the event system assumes those are low level updates

Aron 2020-04-23T15:04:16.043600Z

so I am going to hook up datascript one day to it, and see how far I can push it, because I think it goes all the way 🙂

2020-04-23T15:05:39.044100Z

I've been looking into useMutableSource, no opinions atm

2020-04-23T15:07:34.045100Z

> Afaik, calling in concurrent mode render on the root node with a full state is not different from just calling this.setState Is there anything to read about this somewhere?

2020-04-23T15:09:36.045500Z

That would be good news

Aron 2020-04-23T15:47:38.046100Z

found it 😄

Aron 2020-04-23T15:48:01.046500Z

it might've been true even before Fiber

Aron 2020-04-23T15:48:45.046900Z

someone even answered there, maybe you see who 😄

Aron 2020-04-23T15:48:51.047100Z

funny, this life 🙂

Aron 2020-04-23T15:49:33.047300Z

https://twitter.com/dan_abramov/status/1143206952148918272 this is also relevant

2020-04-23T15:50:05.047600Z

looool 😄

2020-04-23T15:52:28.048900Z

How that would work with subscriptions deep in UI tree + memoized components?

2020-04-23T15:52:53.049400Z

I guess this is just two different models of propagating updates

2020-04-23T15:53:46.050800Z

perhaps React context can be used in such cases

Aron 2020-04-23T15:53:52.051Z

the naiv thing is just to pass props, it's trivial if you attach static query props to components, I am not sure if rum does this? I think om next works like that

Aron 2020-04-23T15:54:07.051400Z

context is the idiomatic react way, but it's surprisingly slow

2020-04-23T15:54:21.051900Z

yeah, I never used it actually in cljs

Aron 2020-04-23T15:56:58.053700Z

The thing is, as long as you want locally managed state, it's going to be difficult. The component's scope needs to access the data which means that either through an argument, through the hidden argument called .this or through a global.

Aron 2020-04-23T15:58:24.054300Z

or, of course, as a local variable to that scope, but then good luck sharing it with children or - even worse- other parts of the application

Aron 2020-04-23T15:59:23.055100Z

https://reactjs.org/docs/lifting-state-up.html this part of the react docs is the biggest admission of failure (and don't get me wrong, I quite like React, probably would use it even when it's not necessary 🙂 )

Aron 2020-04-23T16:00:12.055900Z

after all, the idea of local state is built on the idea of encapsulation from OOP, but if you start moving state up, you by definition break all kinds of OOP principles