Hey guys!

Every time I'm working on some small js/ajax piece of UI for Allura I'm
thinking
that I'm creating something fragile which can break apart in any moment
without
me even noticing. That's mainly because of direct DOM manipulation. The
latest
example of this is https://forge-allura.apache.org/p/allura/tickets/7866/
where
I needed to check a state of background task and display status to the user
and
enable/disable different pieces of UI depending on task result (this pattern
actually can be found in a few places in Allura). Every time I write
something
like this
https://forge-allura.apache.org/p/allura/git/ci/master/tree/Allura/allura/templates/repo/merge_request.html#l218
I feel like I'm stepping on a landmine :)

Does it happen to any of you? :)

The reason I bring this up now is that I'm starting work on phone
verification
UI (#7868) and I expect some of js/ajax shenanigans there as well.  I would
like
to try a different approach for dealing with the DOM, but since it requires
to
pull a new technology into our stack I can't do it before discussing it with
you.

There's a library that removes this pain. It's React.js.  I have some
experience
using it and it's just a breeze for tasks like that. It is built in a way
that
allows to use it only for a small piece of a page, exactly where you need
it, so
there's no need to worry about rewriting existing code to support it and it
can
be included only on a pages that need it. It's pretty small, latest
compressed
version is 129K. For example our jquery-base, which we include on every
page is
twice that size (332K). It's BSD licensed.

I don't think our current situation is *that* bad, but on the other hand it
can
restrain us from trying to build more complex things, UI wise.  In my
opinion it
worth to try React in Allura, starting with such small problems as I
described.
In my case, I'm sure it will give me more confidence, that UI pieces I build
work as expected.

What do you think?

Reply via email to