Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3372613
D6154.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6154.diff
View Options
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -983,6 +983,37 @@
currentAsOf: messageStore.currentAsOf,
},
};
+ } else if (action.type === sendReactionMessageActionTypes.failed) {
+ const { localID, threadID } = action.payload;
+ const messageStoreOperations = [];
+
+ messageStoreOperations.push({
+ type: 'remove',
+ payload: { ids: [localID] },
+ });
+
+ const newMessageIDs = messageStore.threads[threadID].messageIDs.filter(
+ id => id !== localID,
+ );
+
+ const processedMessageStore = processMessageStoreOperations(
+ messageStore,
+ messageStoreOperations,
+ );
+
+ return {
+ messageStoreOperations,
+ messageStore: {
+ ...processedMessageStore,
+ threads: {
+ ...messageStore.threads,
+ [threadID]: {
+ ...messageStore.threads[threadID],
+ messageIDs: newMessageIDs,
+ },
+ },
+ },
+ };
} else if (
action.type === sendTextMessageActionTypes.success ||
action.type === sendMultimediaMessageActionTypes.success ||
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -538,9 +538,11 @@
+type: 'SEND_REACTION_MESSAGE_FAILED',
+error: true,
+payload: Error & {
- +targetMessageID: string,
+ +localID: string,
+threadID: string,
+ +targetMessageID: string,
+reaction: string,
+ +action: string,
},
+loadingInfo: LoadingInfo,
}
diff --git a/native/chat/reaction-message-utils.js b/native/chat/reaction-message-utils.js
--- a/native/chat/reaction-message-utils.js
+++ b/native/chat/reaction-message-utils.js
@@ -10,6 +10,7 @@
import { messageTypes } from 'lib/types/message-types';
import type { RawReactionMessageInfo } from 'lib/types/messages/reaction';
import type { BindServerCall, DispatchFunctions } from 'lib/utils/action-utils';
+import { cloneError } from 'lib/utils/errors';
import type { InputState } from '../input/input-state';
import type { AppNavigationProp } from '../navigation/app-navigator.react';
@@ -91,7 +92,11 @@
cancelable: true,
},
);
- throw e;
+
+ const copy = cloneError(e);
+ copy.localID = localID;
+ copy.threadID = threadID;
+ throw copy;
}
})();
diff --git a/web/chat/reaction-message-utils.js b/web/chat/reaction-message-utils.js
--- a/web/chat/reaction-message-utils.js
+++ b/web/chat/reaction-message-utils.js
@@ -14,6 +14,7 @@
useDispatchActionPromise,
useServerCall,
} from 'lib/utils/action-utils';
+import { cloneError } from 'lib/utils/errors';
import Alert from '../modals/alert.react';
import { useSelector } from '../redux/redux-utils';
@@ -66,7 +67,11 @@
Please try again later
</Alert>,
);
- throw e;
+
+ const copy = cloneError(e);
+ copy.localID = localID;
+ copy.threadID = threadID;
+ throw copy;
}
})();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 7:16 AM (21 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2589325
Default Alt Text
D6154.diff (3 KB)
Attached To
Mode
D6154: [lib/native/web] handle send reaction message action failed case
Attached
Detach File
Event Timeline
Log In to Comment