Skip to content
Extraits de code Groupes Projets
Valider aff22bfd rédigé par Eugen Rochko's avatar Eugen Rochko
Parcourir les fichiers

Add own composed status to home without waiting for websocket event

This makes the UI appear less laggy. After all, the status *is* created
right there and then, it's the distribution to home timelines that can take
a while
parent 4b357ecf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
import api from '../api' import api from '../api'
import { updateTimeline } from './timelines';
export const COMPOSE_CHANGE = 'COMPOSE_CHANGE'; export const COMPOSE_CHANGE = 'COMPOSE_CHANGE';
export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST'; export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST';
export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS'; export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS';
...@@ -66,9 +68,13 @@ export function submitComposeRequest() { ...@@ -66,9 +68,13 @@ export function submitComposeRequest() {
}; };
export function submitComposeSuccess(status) { export function submitComposeSuccess(status) {
return { return (dispatch, getState) => {
type: COMPOSE_SUBMIT_SUCCESS, dispatch({
status: status type: COMPOSE_SUBMIT_SUCCESS,
status: status
});
dispatch(updateTimeline('home', status));
}; };
}; };
......
...@@ -95,6 +95,10 @@ const updateTimeline = (state, timeline, status, references) => { ...@@ -95,6 +95,10 @@ const updateTimeline = (state, timeline, status, references) => {
state = normalizeStatus(state, status); state = normalizeStatus(state, status);
state = state.update(timeline, list => { state = state.update(timeline, list => {
if (list.includes(status.get('id'))) {
return list;
}
const reblogOfId = status.getIn(['reblog', 'id'], null); const reblogOfId = status.getIn(['reblog', 'id'], null);
if (reblogOfId !== null) { if (reblogOfId !== null) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter