]> cat aescling's git repositories - mastodon.git/commit
Replace repetitive blurhash code with component (#14267)
authorSasha Sorokin <dafri.nochiterov8@gmail.com>
Thu, 9 Jul 2020 11:01:30 +0000 (18:01 +0700)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 11:01:30 +0000 (13:01 +0200)
commit61c07c37317f01c1ab4981826704750fe9937fe7
treeabecace8339a034b8615c4a11eabf541c178bdb5
parent5b7a93b02cfa4916bd7a99d876b0e6b567e639c3
Replace repetitive blurhash code with component (#14267)

This commit replaces all unnecessarily repeated code for decoding and
embedding blurhash canvases with separate component - <Blurhash>.

Under the hood Blurhash component will use effect dependent on its
props. This gives a few benefits: it will only be re-rendered whenever
the hash or width/height/dummy props update, and will not render if
canvas won't get to the final DOM, because then effect won't fire,
which prevents weird bugs like #14257.
app/javascript/mastodon/components/blurhash.js [new file with mode: 0644]
app/javascript/mastodon/components/media_gallery.js
app/javascript/mastodon/features/account_gallery/components/media_item.js
app/javascript/mastodon/features/status/components/card.js
app/javascript/mastodon/features/video/index.js