MyBB Community Forums

Full Version: Single Page Applications
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As this was a topic on Discord and it's largely tapped out there, I'll bring it up here.

This is mostly a 2.0 thing, but there are matters which pertain to 1.10. What direction is good with this? If Twig is adopted, adopting Vue or React in 2.0 or 3.0, as the team has leaned towards on Discord on several occasions will mean a double whammy of theme breakage and may make things tricky with ads networks which don't play nicely with SPAs (which are surprisingly common).

One possible option is to take a look at this earlier in the life of MyBB, as early as 1.10, and to think carefully about what implications the adoption of Twig may have. One option is even to use Twig on the JS side at a later date, if a choice if given to go all-in: https://github.com/twigjs/twig.js

With Twig, even if a switch is flipped or the site breaks, it can theoretically gracefully degrade to more classical functionality.
SPA (react style) doesn't even work for forums that are built around the idea from the ground up.

At the same time if you really want that, there is already alternatives available.

It's not something MyBB should dabble in. Keep it simple.
SPAs can significantly improve the server side performance, the bandwidth usage of a site, and it can have world changing improvements in client side performance and usability, although this is mainly the case for recurring visitors rather than bounces.

That said, an improvement in usability will give you a massive competitive edge over sites which aren't as usable. Unfortunately, if ads don't work properly, it's a problem even in NodeBB, then sites won't be able to monetise effectively and pay the bills.

I personally find that the biggest problem for me with these options like NodeBB and Discourse is that they have an obsession with absolutely spartan themes, which are instant turn-offs the moment I look at them. When I look at Misago, the concept isn't anywhere near as terrible as when I look at Discourse.
I can't see this ever happening in MyBB, honestly. You might as well just rewrite MyBB from the ground up if you wanted to do this - not the goal of the 1.10 series.
I brought it up here as I'm not fond of the idea being brought up in a few years or so, and yet another template system being plopped down resulting in people having to learn yet another templating language and having to redo their themes.

Apparently, no one discusses these things outside of Discord where it's supposed to be "the future which you'd be an idiot not to adopt" x.x
I don't particularly care either way, but I hope there aren't any surprises in 2020 with dramatic shifts in direction, etc.
I've talked about some of my opinions on Single Page Applications in several places now. I'm not completely against them, but there are a lot of challenges that would need to be overcome for a system like MyBB. One big one off the top of my head is templates. I know there are template engines for JS, such as JSX (for React). All of these template engines require templates to be pre-compiled before use if you want to reach anything like acceptable performance levels. Usually this compilation is done by some node.js library ran in something like Gulp or Brunch or WebPack or whatever else the JS community are using this week of the month.

Obviously, requiring node.js on every server that myBB runs on would be a drastic change for a fairly small gain. If somebody could come up with an obvious, maintainable and well tested way to handle things such as templates, I'd be happy to hear/see it.

There's also the fact that for a lot of the developers currently on the team JS isn't one of their favourite languages or a language they have too much practice in. For many of the team, they may never have touched a framework like React or any of the alternatives.

Also of interest may be thiw Twitter thread discussing some pain points with the current state of JavaScript as it stands - many are valid complaints and would affect MyBB: https://twitter.com/seldo/status/934628217591283712
I heard Flarum (PHP forum) use https://mithril.js.org/ for frontend spa, and nodebb (Node.js forum) uses https://github.com/benchpressjs/benchpressjs for frontend spa. Mithrill.js is quite similar to React programming utilizing concept of components.
Personally I like this spa feature because not only being faster to swap pages, it also allow me to change page and let people enjoy the forum while playing some videos without page and video refresh, like what Youtube does. And also stable websocket connection without reconnecting per each page swap allows me to implement and use many different things like socket.io chat and so on. With spa I think there are so many things that make forum dynamic through plugin supports with spa feature like discord app. I think having spa isn't really a small gain.