9 ms·
Summarizing: - It re-renders on click - It mutates pop/push/... to observe arrays - Otherwise, you have to manually call `update()` IMO, don't touch this. A
by SebastianKra 3y ago
Summarizing:
- It re-renders on click
- It mutates pop/push/... to observe arrays
- Otherwise, you have to manually call `update()`
IMO, don't touch this. All of this has been tried before. It also looks like lists are unkeyed. If you receive another list from the server, you have to do the diffing yourself.
It's disappointing that a framework proclaiming to solve all issues of frontend dev, while evidently understanding none of them, will go uncriticised by HN.
- pupppet 3y agoLifecyle of every JS framework seems to be.. 1. Look how little boilerplate we have! 2. Oops actually we need more boilerplate.
- willio58 3y ago> will go uncriticised by HN. Says the comment at the top of the thread criticizing the project.
- tipiirai 3y agoKeys are unnecessary in Nue, just like many, many other framework abstractions. If you receive another list from the server, Nue takes care of it automatically. No need for diffing.
- Timon3 3y ago"Keys are unnecessary" in what way? The only reason they are necessary in React etc. is to keep DOM mutations to a minimum. Are keys unnecessary because you always re-render the whole list, making for very inefficient updates?
- tipiirai 3y agoTrue. When the array changed, the view is indeed re-rendered. Nue is probably not a good pick ATM for UI's with hundreds of rows and when list re-rendering performance is critical. I'll add the key- support if this becomes a frequent issue.
- lucideer 3y ago> if this becomes a frequent issue This becomes a frequent issue in any app at scale. If your app is at a small enough scale that it doesn't run into this issue, I would not recommend using a framework: just use vanillajs &/or some modular utility components. If you're working on a small app & want to do it in a framework because you anticipate scale, use one with key support.
- tipiirai 3y agoHardly a frequent issue. I use zero apps in real life with more than 30 items on a single view, let alone 100 or 1000 — that all needs to be completely changed in one operation without re-rendering. It's a common theme in benchmarking apps though, which will ultimately be the main reason for adding the key support.
- latchkey 3y ago> I use zero apps in real life with more than 30 items on a single view, let alone 100 or 1000 I do. You've now disqualified this entire framework over a single issue, number of items in a list.
- SebastianKra 3y agohttps://github.com/nuejs/nuejs/blob/a5c844494852cdbe3282fdc588ca81742f39b56e/src/for.js#L43 https://github.com/nuejs/nuejs/blob/a5c844494852cdbe3282fdc5... Am I correctly reading that you just throw away and re-render the entire DOM?
- xnorswap 3y agoThis does just seem like a worse version of knockout. In knockout (with typescript annotations), the equivalent would be: let count = Knockout.Observable<number>(0); And it's then much clearer when you want to access the value of the observable with count() or update it with count(1234) or count(x => x+1 ). ( I may have hallucinated the ability to pass a function to the observable ).
- SebastianKra 3y agoAt least there were observables. Here, you're on your own if there are any external updates (timers, sse, etc...).
- tipiirai 3y agoYes. If there are timers, SSE, or fetch responses you must explicitly call the update() method.
- jampekka 3y agoWill go uncriticized? The comments are full of these kinds of posts dismissing it off hand based mostly on self-declared "understanding". The ceremony and huge verbose architecture astronaut frameworks has been tried before. But the people on this enterprisey very professional corporate busywork hype train are probably too inexperienced to rember the SOAPs and J2EEs and Enterprise Java Beans and dependency injection frameworks and Boosts to understand what drag they are to development and software quality. It'll blow over again in a few years but it's quite sad that the same mistakes have to be repeated.
- nickstinemates 3y agoThis comment gave me PTSD. Been there, lived that.
- tipiirai 3y agoThank you Pekka! (Making a super wild guess that you are from Finland and your name is Pekka :)
- jampekka 3y agoI am from Finland but Pekka is the beginning of my surname. The nick is just some old system-assigned login name that stuck (your's seems the same). Thank you for Nue and bringing much needed simplicity and elegance to frontend dev! I'll be sure to at least try out Nue for the next frontend project that could benefit from a framework.
- SebastianKra 3y agoI was referring to the last time this framework was posted. I'm glad to see that it's being taken apart much more thoroughly this time around. If you consider keyed lists and reactivity mechanisms to be "enterprisey very professional corporate busywork", then I don't know what to say to you.