There is nothing I hate more in JavaScript than frameworks that will not let you turn off their stupid SSR compiling

https://cdn.hzrd149.com/b7d9739a0068d8ae75695e019ec9c7c96d02a0e6dcfdd3aa2f4bce1c46f36738.webp

Vibe coded that whole app then tried to compile with ssr=false and its still trying to run the code in node so it can do some ssr crap. why cant we just have simple static apps anymore?

Reply to this note

Please Login to reply.

Discussion

Because frameworks. Ditch the frameworks.

easier said than done. there is only so much you can do with vanilla JS and almost all AI models only know how to work with popular frameworks. so getting them to build custom vanilla JS is fighting the current

There's a lot you can do with vanilla Js. Keeping it organized is the hard part. But that's why I use go and just use js for web stuff. This presents it's own challenges of course 😂

The main reason I cant use vanilla JS is that having the rendered HTML written and defined in the same file as the components logic is so much better than the vanilla (jquery style) of working with the DOM. because your writing logic in one file for the markdown that's defined in another...

There are decent frameworks like https://lit.dev but it still doesn't provide all the benefits you get from JSX or svelte

I'm with you, what framework is this?

react-router v7, it used to be a simple client router and now its apparently a SSR framework

I've been wanting to use something like svelte for a while now because its components are cleaner than react, but its got the same issues. I can never figure out how to completely disable the SSR and its always throwing "window not defined" errors 😞

Yeah sveltekit is a pain. I got it to work, but it's kind of arcane. Mithriljs doesn't have any ssr crud since development stoppd in 2017 😂

I just read the rest of the thread, you should try mithril! JOIN US (me)

Show me how you could easily use rxjs observables in it and ill be sold.

I played with SolidJS for a while because it was super easy to integrate observables in the components just by doing `const active = from(accounts.active$)`

And for react I've gotten it down to as simple as `const active = use$(accounts.active$)` or `const events = use$(() => pool.subscription(relay, ...), [relay])

Here's an example from https://github.com/coracle-social/nonboard using svelte stores:

```

unsubscribe = state.subscribe(s => m.redraw())

```

Mithril uses a virtual dom, so this isn't much worse than react to begin with. To avoid re-calculating sub-trees (since rendering happens starting from the top) you might use `onbeforeupdate`, or `m.render` to isolate stuff more manually. I haven't gone that deep yet, but I'm sure it's possible.

To explain the example: that just listens to the global state store and redraws when it changes. You could do the same with a `use` helper that registers/unregisters observables/stores

I threw a proof of concept together to satisfy both our curiosity: https://github.com/staab/mithril-granular/blob/master/index.html

This allows you to call `this.use` in a component. It's not quite as clean as react/svelte, because it's less magical. The `onbeforeupdate` method is also a footgun as written (since it would prevent stateful child components from re-rendering), but that's an optimization anyway. Also see https://mithril.js.org/stream.html for mithril's own reactive solution. I'll have to give it a real try sometime.