decent-chat / decent

Open source messaging platform for the modern web
https://meta.decent.chat
GNU General Public License v3.0
21 stars 5 forks source link

Client is a mess #259

Open bates64 opened 6 years ago

bates64 commented 6 years ago

Warning: typical alex below. Beware.


We really need to move stuff around in the client source. emit('messages.fetch') and being unable to detect when it finishes is horrible, etc, etc. We should use the event emitter a lot less and just use controllers to do things, eg. require('./messages/controller').fetch(messagesEl, channel), or something. I don't know. It just seems super flaky at the moment and it's causing stupid bugs like how channelrefs never work and glitch out and generally go wrong. Aaaa. Not fun.

I mean, you can make things, but they always seem super shaky and generally bad. We could attempt to make something similar to @TheInitializer's (currently unreleased) decent.py for Node/browsers to simplify business logic..? That could help.

PullJosh commented 6 years ago

Have we considered using Redux? It can work with any view library (not just react!) and should help with organizing the barrage of state changes that need to be dealt with.

bates64 commented 6 years ago

Totally! Redux is cool. MobX is also cool. Which to use? :stuck_out_tongue_winking_eye:

We could attempt to make something similar to @TheInitializer's (currently unreleased) decent.py for Node/browsers to simplify business logic..? That could help.

Also, I definitely want to try this. It'd be great for abstracting out stuff from the views. Would be helpful for others, too.

PullJosh commented 6 years ago

Redux is cool. MobX is also cool. Which to use? :stuck_out_tongue_winking_eye:

I would strongly recommend going with Redux. One of the big hurdles with choo has been that nobody is familiar with it, so nobody can contribute to the client without spending a bunch of time learning how choo works.

Although the popularity difference between Redux and MobX is much less extreme than choo vs React, I still think it's something to take into consideration. I would also expect Redux to have stronger support throughout other tools/frameworks than MobX, and redux goes hand-in-hand with (p)react if we choose to make the jump.

bates64 commented 6 years ago

Note that this is going super well in the preact branch. Decoupling non-UI logic into its own package was a great idea.