the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
989 stars 117 forks source link

Modernize the frontend tooling #441

Closed pemocarlo closed 1 year ago

pemocarlo commented 2 years ago

Is your feature request related to a problem? Please describe. I was checking this project and see it as a refreshed version of Nextcloud. Unfortunately, one of the parts that I still see as obsolete is the knockoutjs library, which looks almost unmaintained. This also reduces the possibility of integration with more modern technologies, such as SSR.

Describe the solution you'd like Use a more modern framework, such as React, Vue or Svelte. There is also a next-gen version of Knockout, called tko which seems to almost be a drop-in replacement but with a more modern implementation. It is nevertheless not officially released yet.

Describe alternatives you've considered None

Additional context I know this is a big change, but just wanted to mention it in case you have considered. I would like to know your thoughts about what the feasibility of this.

the-djmaze commented 2 years ago

SSR (server side rendering) means more resource use on the server. SnappyMail is fast because it tries to render the most on the client. Something most developers forget is the strain on a server when they develop something. It works "fast enough" when they develop it, but never benchmark and test with 1000 simultanious connections.

Although Knockout is old, the slimmed/modified version SnappyMail uses is fine for current browsers.

I've tested TKO, Vue, React and many others, but none of them does the job better/faster (solidjs is a good alternative).

The reason is three very important complex tasks:

  1. Handling of "property listeners"
  2. Handling of Array changes
  3. Modify templates by extensions/plugins

All frameworks have magic methods to find and listen to dynamic properties. This is a lot of overhead and nowadays we have the native Proxy in JavaScript for that (i even tested this approach). All of them have good and bad points, but none have enough benefits to rewrite the whole source.

SnappyMail does use a kind of "Proxy" on Array for better handling of changes with push, pop, splice, etc. etc.

My conclusion was that currently it is still not worth the time to rewrite all code just because some other framework is "hot" at this moment and people preaching that this "is the best" framework. As we all know, in 5 years there's a new "best" framework.