Fix upload file input being re-rendered needlessly

This commit is contained in:
Eugen Rochko 2017-01-16 14:21:55 +01:00
parent 7d53ee73f3
commit 1a33e4042e
3 changed files with 9 additions and 6 deletions

View file

@ -38,7 +38,8 @@ const initialState = Immutable.Map({
media_attachments: Immutable.List(),
suggestion_token: null,
suggestions: Immutable.List(),
me: null
me: null,
resetFileKey: Math.floor((Math.random() * 0x10000))
});
function statusToTextMentions(state, status) {
@ -65,6 +66,7 @@ function appendMedia(state, media) {
return state.withMutations(map => {
map.update('media_attachments', list => list.push(media));
map.set('is_uploading', false);
map.set('resetFileKey', Math.floor((Math.random() * 0x10000)));
map.update('text', oldText => `${oldText} ${media.get('text_url')}`.trim());
});
};