Live data from Hacker News

Show HN: Sapper.js – towards a better web app framework

svelte.technology

151–160 of 219 posts

Re: Show HN: Sapper.js – towards a better web app framework

#151
Sounds interesting. He mentions that his gzipped size for the RealWorld project is about 40KB. There was a good comparison done with this project[0] in which one of the frameworks (AppRun) weighed in at 19KB. 19KB is pretty crazy. Has anyone here used AppRun?

[0] https://medium.freecodecamp.org/a-real-world-comparison-of-f...

Re: Show HN: Sapper.js – towards a better web app framework

#152
post #150

Earlier quoted context omitted.

Colons indicate that something is a directive rather than an attribute — so `on:click` is the `on` directive with the `click` event, and `bind:thing` is the `bind` directive with the `thing` data property. The one place we violate that slightly is with `:foo`, which is shorthand for `foo={{foo}}` (since people dislike the ceremony of passing props down between components, and this makes it easier). {{#if condition}}.…

The problem with Svelte's computed properties is that it's not just an idiom, but a completely new language that happens to look like JS. It does things JS can't, and breaks very basic things like functional composition. Why not simply use the "correct" ES6 syntax to do the same thing? It's almost identical: computed: { hours: ({time}) => time.getHours(), minutes: ({time}) => time.getMinutes(), seconds: ({time}) => t…

Interesting idea! I've raised an issue, thanks — https://github.com/sveltejs/svelte/issues/1069

Re: Show HN: Sapper.js – towards a better web app framework

#153
> the framework should do automatic code-splitting at the route level, and support dynamic import(...) for more granular manual control

I disagree! Code-splitting is arguably an architectural dead-end for SPAs:

1) It adds a non-trivial layer of complexity to both your application logic and your tooling. SPAs (and the JS ecosystem in general) are already complicated enough without this extra layer of indirection, and that complexity carries a higher cost than most people realize, especially when it's blindly accepted across the industry as best practice.

2) It's based on the conflation of apps with collections of hypertext documents, whereas in reality these are different architectures with different trade-offs. We're under no such delusions for apps in the app store for example, and thus nobody bats an eye if one takes a full minute to download.

I guess this isn't what people want to hear, but the web is more than apps, and we need to stop pushing SPA as the default way to build every new website. Code-splitting is merely the by-product of choosing the wrong architecture. In cases where SPA is the right tool for the job, we need to make users aware that they're downloading an actual app. I.e. a one-time install screen implemented via some kind of service-worker-driven bootstrapper: "Just a moment while we install your app..."

Re: Show HN: Sapper.js – towards a better web app framework

#154
post #150

Earlier quoted context omitted.

Colons indicate that something is a directive rather than an attribute — so `on:click` is the `on` directive with the `click` event, and `bind:thing` is the `bind` directive with the `thing` data property. The one place we violate that slightly is with `:foo`, which is shorthand for `foo={{foo}}` (since people dislike the ceremony of passing props down between components, and this makes it easier). {{#if condition}}.…

The problem with Svelte's computed properties is that it's not just an idiom, but a completely new language that happens to look like JS. It does things JS can't, and breaks very basic things like functional composition. Why not simply use the "correct" ES6 syntax to do the same thing? It's almost identical: computed: { hours: ({time}) => time.getHours(), minutes: ({time}) => time.getMinutes(), seconds: ({time}) => t…

At first, this looked like a bad idea but now can see the value but also see the ugly and less-friendly to newcomers angle.

Trouble is, coming from a Vue background (where computed props do not have to rely on a state item), the pre-requisite in Svelte to do so seemed at first a major PITA (then I saw the light/benefits and was actually easily able to re-work the Vue versions to Svelte).

Unless this is the only place Svelte goes slightly 'off-piste' in terms of JS then personally I'd leave as is, otherwise make the change

Re: Show HN: Sapper.js – towards a better web app framework

#155
post #87

Earlier quoted context omitted.

You should learn React and build a simple project with it to understand its real value, which is component-based architecture. React will likely be around longer than/as long as any framework, but whatever replaces it will use a lot of the same concepts.

How does that help 1000 visitors to a blog read the blog easier? Not every site is an app, and the apps we do build we already have invested in VanillaJS framework. Do you think React will outlast the VanillaJS framework? ( http://vanilla-js.com/ ) (edit: this is partly a joke comment, fyi)

I understand the joke but JS isn't a framework, it's a language.

"No framework" generally means "poorly-written custom framework". Do you have any code samples to share from your vanilla JS apps?

Re: Show HN: Sapper.js – towards a better web app framework

#156
post #111
post #63

Earlier quoted context omitted.

>Sudenly everything needs to be SPA, every site needs to load hundreds KBs of scripts just to "be current". Not everything has to be an SPA, but React is 30kb gzipped and Preact et al are in the single digits. >What's the value of being modern if it makes user experience objectively worse? The point is they don’t inherently make user experience objectively worse. >Sure client side render may prevent you from reloadin…

> The point is they don’t inherently make user experience objectively worse. Ah, but they do. Browsers are very mature and predictable in their management of html pages and SPA's break that behavior in subtle, uncanny-valley ways. For instance, click into the Sapper HN page https://hn.svelte.technology/item/16052558 , scroll down to a post with a random link and click into it. Click on another page in that link. Now…

> You find that you will be at the top of the page as it re-renders. You lose the place you were scrolled to.

What browser is that happening in? In Chrome it works correctly — Sapper uses `history.scrollRestoration = 'manual'` for this exact reason, but maybe it fails elsewhere? It's a bug, and we should fix it. (This is pre-1.0 software, your forbearance is appreciated.)

Re: Show HN: Sapper.js – towards a better web app framework

#158
post #128
post #42

Earlier quoted context omitted.

I feel like a lot of HN is stuck in 2010 and dislikes all of this new web tech because they don’t understand it. This comment is a prime example.

I am willing to concede your pedigree as a developer as necessary but I've been writing all manner of languages and environments since 99 and I'm sorry to say there's no revolution here, no battlefield to die on. It's a poor model that has been tried and abandoned any number of times in my career. The ubiquity of platforms that suit these ideas and developers who think Web development began with node and spas isn't c…

My problem is that every JS-framework story on HN is full of comments either a) showing a lack of understanding of the tech like the parent, or b) bringing up "fundamental issues" with SPAs which are either nonexistent or long-solved.

That isn't to say some concerns might not have merit, but SEO/SSR/shared routing/state/templates are problems with production-ready OOTB solutions.

If someone isn't familiar with the basic SoTA then they should refrain from commenting so harshly on it.

Re: Show HN: Sapper.js – towards a better web app framework

#159

Earlier quoted context omitted.

What about when you start clicking the links in the nav, or opening other stories and profile pages? As far as I can see, the Sapper version blows the original out of the water.

The Sapper version is cheating a little. It is preloading the pages on mouseOver events of the links.

It's not just cheating a little. Just moving the mouse around the page causes lots of data to be downloaded behind the scenes; you could end up loading every story on HN without ever leaving the Top list. That's not friendly to user's data plans, and it's very far from expected browser behavior.

Re: Show HN: Sapper.js – towards a better web app framework

#160
post #128
post #42

Earlier quoted context omitted.

I feel like a lot of HN is stuck in 2010 and dislikes all of this new web tech because they don’t understand it. This comment is a prime example.

I am willing to concede your pedigree as a developer as necessary but I've been writing all manner of languages and environments since 99 and I'm sorry to say there's no revolution here, no battlefield to die on. It's a poor model that has been tried and abandoned any number of times in my career. The ubiquity of platforms that suit these ideas and developers who think Web development began with node and spas isn't c…

The real problem React solves is enabling many people to work on parts of the same page without stepping on each other. The declarative nature is brilliant, but if the messy MVC diagram slides in the reveal presentation are real, then I feel confident in labeling React this way.
Post reply on HN