Skip to content

Commit

Permalink
chore: cancel animation after REST req when sockets is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
aineo committed Jul 15, 2024
1 parent 78de26d commit 907785e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/store/modules/chat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ const actions = {
* This is a temporary solution until the sockets are implemented.
* @returns {Promise}
*/
getNewMessages({ state, commit, dispatch }) {
getNewMessages({ state, commit, dispatch, rootState }) {
if (!state.isFulfilled) {
return Promise.reject(new Error('Chat is not fulfilled'))
}
Expand All @@ -638,7 +638,7 @@ const actions = {

dispatch('pushMessages', messages)

if (messages.length > 0) {
if (!rootState.options.useSocketConnection && messages.length > 0) {
dispatch('animateLastReaction', ART.Incoming)
}

Expand Down Expand Up @@ -868,7 +868,6 @@ const actions = {
* Animation of last reaction with vibro
* @param {ART} type - animation reaction type - incoming or outgoing
*/

animateLastReaction({ commit }, type) {
const updateFn =
type === ART.Incoming ? 'updateAnimateIncomingReaction' : 'updateAnimateOutgoingReaction'
Expand Down

0 comments on commit 907785e

Please sign in to comment.