stream-chat 10.0.0-rc.21 → 10.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/cjs/index.browser.js +2196 -3902
  2. package/dist/cjs/index.browser.js.map +3 -3
  3. package/dist/cjs/index.node.js +2197 -3902
  4. package/dist/cjs/index.node.js.map +3 -3
  5. package/dist/esm/index.mjs +2199 -3905
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelManager.d.ts +120 -233
  8. package/dist/types/CooldownTimer.d.ts +8 -23
  9. package/dist/types/EventHandlerPipeline.d.ts +17 -37
  10. package/dist/types/LiveLocationManager.d.ts +22 -50
  11. package/dist/types/api-client.d.ts +9 -14
  12. package/dist/types/channel.d.ts +253 -448
  13. package/dist/types/channel_state.d.ts +48 -95
  14. package/dist/types/client.d.ts +245 -370
  15. package/dist/types/client_state.d.ts +1 -3
  16. package/dist/types/configuration/ConfigController.d.ts +30 -124
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
  18. package/dist/types/configuration/keys.d.ts +5 -19
  19. package/dist/types/configuration/shape.d.ts +12 -29
  20. package/dist/types/configuration/types.d.ts +59 -87
  21. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
  22. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  23. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  24. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  25. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  26. package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
  27. package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
  28. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
  29. package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
  30. package/dist/types/connection/networkConnection/types.d.ts +12 -27
  31. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
  32. package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
  33. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
  34. package/dist/types/connection/wsConnection/config.d.ts +8 -28
  35. package/dist/types/connection/wsConnection/types.d.ts +17 -70
  36. package/dist/types/entityStore/EntityStore.d.ts +153 -113
  37. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
  38. package/dist/types/errors.d.ts +7 -19
  39. package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
  40. package/dist/types/gen/chat/ChatApi.d.ts +28 -14
  41. package/dist/types/gen/models/index.d.ts +769 -86
  42. package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
  43. package/dist/types/index.d.ts +2 -4
  44. package/dist/types/languageNames.d.ts +9 -24
  45. package/dist/types/logger.d.ts +1 -3
  46. package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
  47. package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
  48. package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
  49. package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
  50. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  51. package/dist/types/messageComposer/configuration/types.d.ts +29 -56
  52. package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
  53. package/dist/types/messageComposer/messageComposer.d.ts +30 -164
  54. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
  55. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
  56. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  57. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  58. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
  59. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
  60. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  61. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  62. package/dist/types/messageComposer/pollComposer.d.ts +8 -4
  63. package/dist/types/messageComposer/textComposer.d.ts +3 -9
  64. package/dist/types/messageComposer/types.d.ts +5 -8
  65. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
  66. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
  67. package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
  68. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
  69. package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
  70. package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
  71. package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
  72. package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
  73. package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
  74. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
  75. package/dist/types/messageOperations/types.d.ts +15 -30
  76. package/dist/types/middleware.d.ts +7 -5
  77. package/dist/types/moderation.d.ts +21 -14
  78. package/dist/types/notifications/NotificationManager.d.ts +8 -31
  79. package/dist/types/notifications/types.d.ts +19 -59
  80. package/dist/types/offline-support/offline_support_api.d.ts +145 -539
  81. package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
  82. package/dist/types/offline-support/queueableOperations.d.ts +24 -52
  83. package/dist/types/offline-support/types.d.ts +24 -187
  84. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  85. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  86. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
  87. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
  88. package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
  89. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
  90. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
  91. package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
  92. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
  93. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
  94. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
  95. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
  96. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  97. package/dist/types/pagination/utility.normalization.d.ts +5 -23
  98. package/dist/types/pagination/utility.search.d.ts +3 -8
  99. package/dist/types/poll.d.ts +14 -14
  100. package/dist/types/poll_manager.d.ts +11 -2
  101. package/dist/types/poll_optimistic_votes.d.ts +10 -14
  102. package/dist/types/reminders/Reminder.d.ts +4 -4
  103. package/dist/types/reminders/ReminderManager.d.ts +7 -20
  104. package/dist/types/search/BaseSearchSource.d.ts +7 -12
  105. package/dist/types/search/ChannelSearchSource.d.ts +7 -7
  106. package/dist/types/search/MessageSearchSource.d.ts +7 -9
  107. package/dist/types/search/SearchController.d.ts +17 -22
  108. package/dist/types/search/types.d.ts +6 -10
  109. package/dist/types/signing.d.ts +12 -3
  110. package/dist/types/thread.d.ts +23 -71
  111. package/dist/types/thread_manager.d.ts +45 -70
  112. package/dist/types/token_manager.d.ts +8 -13
  113. package/dist/types/types.d.ts +64 -125
  114. package/dist/types/types.utility.d.ts +3 -3
  115. package/dist/types/upload-utils.d.ts +5 -10
  116. package/dist/types/uploadManager.d.ts +17 -45
  117. package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
  118. package/dist/types/utils/WithSubscriptions.d.ts +5 -15
  119. package/dist/types/utils/concurrency.d.ts +11 -19
  120. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  121. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  122. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  123. package/dist/types/utils/objectPath.d.ts +6 -41
  124. package/dist/types/utils/retryable.d.ts +8 -12
  125. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  126. package/dist/types/utils/time.d.ts +24 -64
  127. package/dist/types/utils.d.ts +40 -86
  128. package/package.json +7 -2
  129. package/src/ChannelManager.ts +159 -300
  130. package/src/CooldownTimer.ts +11 -29
  131. package/src/EventHandlerPipeline.ts +21 -44
  132. package/src/LiveLocationManager.ts +35 -74
  133. package/src/api-client.ts +43 -61
  134. package/src/campaign.ts +1 -1
  135. package/src/channel.ts +396 -749
  136. package/src/channel_batch_updater.ts +1 -1
  137. package/src/channel_state.ts +50 -105
  138. package/src/client.ts +360 -588
  139. package/src/client_state.ts +1 -6
  140. package/src/configuration/ConfigController.ts +41 -157
  141. package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
  142. package/src/configuration/index.ts +1 -1
  143. package/src/configuration/keys.ts +13 -32
  144. package/src/configuration/shape.ts +67 -70
  145. package/src/configuration/types.ts +60 -100
  146. package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
  147. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  148. package/src/configuration/utils/declarativeSlices.ts +9 -39
  149. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  150. package/src/configuration/utils/index.ts +2 -4
  151. package/src/configuration/utils/serverAuthority.ts +20 -68
  152. package/src/connection/ConnectionIdManager.ts +20 -49
  153. package/src/connection/ConnectionRecoveryManager.ts +51 -178
  154. package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
  155. package/src/connection/networkConnection/reporters.ts +9 -36
  156. package/src/connection/networkConnection/types.ts +12 -27
  157. package/src/connection/wsConnection/StableWSConnection.ts +73 -193
  158. package/src/connection/wsConnection/WSConnection.ts +56 -131
  159. package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
  160. package/src/connection/wsConnection/config.ts +13 -48
  161. package/src/connection/wsConnection/types.ts +17 -70
  162. package/src/constants.ts +4 -4
  163. package/src/entityStore/EntityStore.ts +162 -167
  164. package/src/entityStore/StoreBackedItemIndex.ts +14 -47
  165. package/src/errors.ts +7 -19
  166. package/src/formatMessageMemo.ts +3 -9
  167. package/src/gen/chat/ChannelApi.ts +19 -0
  168. package/src/gen/chat/ChatApi.ts +87 -13
  169. package/src/gen/models/index.ts +793 -71
  170. package/src/gen/moderation/ModerationApi.ts +0 -4
  171. package/src/index.ts +10 -14
  172. package/src/languageNames.ts +9 -24
  173. package/src/logger.ts +1 -3
  174. package/src/messageComposer/LocationComposer.ts +7 -23
  175. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  176. package/src/messageComposer/attachmentIdentity.ts +2 -13
  177. package/src/messageComposer/attachmentManager.ts +17 -63
  178. package/src/messageComposer/attachmentUtils.ts +3 -17
  179. package/src/messageComposer/configuration/configuration.ts +5 -8
  180. package/src/messageComposer/configuration/types.ts +29 -56
  181. package/src/messageComposer/fileUtils.ts +1 -1
  182. package/src/messageComposer/linkPreviewsManager.ts +8 -20
  183. package/src/messageComposer/messageComposer.ts +54 -222
  184. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
  185. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
  186. package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
  187. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
  188. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  189. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
  190. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  191. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  192. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  193. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
  194. package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
  195. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  196. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  197. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  198. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  199. package/src/messageComposer/pollComposer.ts +11 -8
  200. package/src/messageComposer/textComposer.ts +9 -59
  201. package/src/messageComposer/types.ts +9 -12
  202. package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
  203. package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
  204. package/src/messageOperations/FailedSendCache.ts +4 -9
  205. package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
  206. package/src/messageOperations/MessageOperations.ts +33 -62
  207. package/src/messageOperations/applyReactionLocally.ts +9 -28
  208. package/src/messageOperations/createMessageOperations.ts +17 -33
  209. package/src/messageOperations/reflectReactionEvent.ts +5 -13
  210. package/src/messageOperations/sendOrdering.ts +4 -7
  211. package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
  212. package/src/messageOperations/types.ts +15 -30
  213. package/src/middleware.ts +7 -10
  214. package/src/moderation.ts +25 -21
  215. package/src/notifications/NotificationManager.ts +11 -35
  216. package/src/notifications/types.ts +19 -59
  217. package/src/offline-support/offline_support_api.ts +178 -608
  218. package/src/offline-support/offline_sync_manager.ts +25 -69
  219. package/src/offline-support/queueableOperations.ts +31 -84
  220. package/src/offline-support/types.ts +25 -188
  221. package/src/pagination/ItemIndex.ts +4 -12
  222. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  223. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
  224. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  225. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
  226. package/src/pagination/filterCompiler.ts +11 -25
  227. package/src/pagination/paginators/BasePaginator.ts +422 -976
  228. package/src/pagination/paginators/ChannelPaginator.ts +130 -190
  229. package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
  230. package/src/pagination/paginators/MessagePaginator.ts +135 -175
  231. package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
  232. package/src/pagination/paginators/ReminderPaginator.ts +12 -15
  233. package/src/pagination/paginators/ThreadPaginator.ts +16 -26
  234. package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
  235. package/src/pagination/paginators/stateThrottling.ts +5 -10
  236. package/src/pagination/sortCompiler.ts +23 -50
  237. package/src/pagination/utility.normalization.ts +8 -30
  238. package/src/pagination/utility.search.ts +4 -11
  239. package/src/poll.ts +19 -19
  240. package/src/poll_manager.ts +16 -20
  241. package/src/poll_optimistic_votes.ts +17 -22
  242. package/src/reminders/Reminder.ts +5 -6
  243. package/src/reminders/ReminderManager.ts +9 -34
  244. package/src/reminders/ReminderTimer.ts +1 -2
  245. package/src/search/BaseSearchSource.ts +14 -29
  246. package/src/search/ChannelSearchSource.ts +8 -8
  247. package/src/search/MessageSearchSource.ts +19 -25
  248. package/src/search/SearchController.ts +18 -24
  249. package/src/search/types.ts +6 -10
  250. package/src/segment.ts +1 -1
  251. package/src/signing.ts +23 -3
  252. package/src/thread.ts +72 -173
  253. package/src/thread_manager.ts +59 -76
  254. package/src/token_manager.ts +11 -21
  255. package/src/types.ts +78 -126
  256. package/src/types.utility.ts +3 -3
  257. package/src/upload-utils.ts +5 -10
  258. package/src/uploadManager.ts +22 -54
  259. package/src/utils/FixedSizeQueueCache.ts +13 -21
  260. package/src/utils/WithSubscriptions.ts +5 -15
  261. package/src/utils/concurrency.ts +16 -55
  262. package/src/utils/mergeWith/mergeWith.ts +10 -13
  263. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  264. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  265. package/src/utils/objectPath.ts +6 -41
  266. package/src/utils/retryable.ts +10 -14
  267. package/src/utils/throttling/throttle.ts +9 -25
  268. package/src/utils/time.ts +26 -66
  269. package/src/utils.ts +72 -128
@@ -63,11 +63,7 @@ import {
63
63
 
64
64
  type UnregisterSubscriptions = Unsubscribe;
65
65
 
66
- /**
67
- * Composer edit-audit clock. Both values are unix nanoseconds, so a locally stamped change and a
68
- * server-derived `created_at` / `updated_at` are directly comparable — which is the whole point of
69
- * this state.
70
- */
66
+ /** Unix nanoseconds, directly comparable with server `created_at` / `updated_at`. */
71
67
  export type LastComposerChange = {
72
68
  draftUpdate: TimestampNS | null;
73
69
  stateUpdate: TimestampNS;
@@ -105,18 +101,12 @@ export type MessageComposerSnapshot = {
105
101
  export type CompositionContext = Channel | Thread | LocalMessage;
106
102
 
107
103
  /**
108
- * What a submit did, and by implication where the content now is.
109
- *
110
- * - `sent` - it went out.
111
- * - `nothing-to-send` - there was nothing to compose, or a middleware discarded the composition
112
- * (a command that is not ready, one disabled by the quoted or edited message, an upload still
113
- * running). **The composer keeps its contents**, and the reason has already been reported through
114
- * `client.notifications`.
115
- * - `failed` - the request failed. **The composer has been released**; the content is in the
116
- * message list marked `failed`, where the user retries it.
117
- *
118
- * The distinction matters because the last two leave the composer in opposite states, so a caller
119
- * that reopens or restores UI has to tell them apart.
104
+ * Outcome of `send()` and `update()`:
105
+ * - `sent`: the message or edit went out.
106
+ * - `nothing-to-send`: nothing to compose, or a middleware discarded the composition (reported through
107
+ * `client.notifications`). **The composer keeps its contents.**
108
+ * - `failed`: the request failed. **The composer is released**; the content is in the message list
109
+ * marked `failed`, where the user retries it.
120
110
  */
121
111
  export type MessageComposerSubmitResult = 'sent' | 'nothing-to-send' | 'failed';
122
112
 
@@ -126,18 +116,15 @@ export type MessageComposerState = {
126
116
  pollId: string | null;
127
117
  quotedMessage: LocalMessage | null;
128
118
  showReplyInChannel: boolean;
129
- /**
130
- * Baseline snapshot of the message being edited (if any).
131
- * This is intentionally immutable with respect to the editing session and can be used for restore/cancel.
132
- */
119
+ /** Baseline of the message being edited, unchanged during the session (for restore or cancel). */
133
120
  editedMessage: LocalMessage | null;
134
121
  };
135
122
 
136
123
  export type MessageComposerOptions = {
137
124
  client: StreamChat;
138
- // composer can belong to a channel, thread, legacy thread or a local message (edited message)
125
+ // A channel, a thread, or a local message (edit flow).
139
126
  compositionContext: CompositionContext;
140
- // initial state like draft message or edited message
127
+ // Initial state: a draft or the message being edited.
141
128
  composition?: DraftResponse | MessageResponse | LocalMessage;
142
129
  config?: DeepPartial<MessageComposerConfig>;
143
130
  };
@@ -183,7 +170,7 @@ const initState = (
183
170
  : formatMessage(composition);
184
171
  let message;
185
172
  let draftId = null;
186
- let id = MessageComposer.generateId(); // do not use draft id for messsage id
173
+ let id = MessageComposer.generateId(); // a draft ID is not the message ID
187
174
  if (compositionIsDraftResponse(composition)) {
188
175
  message = composition.message;
189
176
  draftId = composition.message.id;
@@ -210,11 +197,6 @@ export class MessageComposer extends WithSubscriptions {
210
197
  readonly state: StateStore<MessageComposerState>;
211
198
  readonly editingAuditState: StateStore<EditingAuditState>;
212
199
 
213
- /**
214
- * Resolved configuration, as a store — the shape every configurable class exposes
215
- * (`configState` / `config` / `updateConfig`). Delegates rather than holding a copy, so the field and
216
- * the controller's store cannot drift.
217
- */
218
200
  get configState(): StateStore<MessageComposerConfig> {
219
201
  return this.configController.state;
220
202
  }
@@ -230,16 +212,6 @@ export class MessageComposer extends WithSubscriptions {
230
212
  customDataManager: CustomDataManager;
231
213
  private snapshots: MessageComposerSnapshot[] = [];
232
214
  private effectHandlers: MessageComposerEffectHandlers;
233
- /**
234
- * The shared configuration machinery, with the three hooks this entity is the only one to need:
235
- * `retainPatches` so an `updateConfig` request is *retained* and re-applied rather than written
236
- * into the result (**DV-18**), and `applyAuthority` for the server's last word.
237
- *
238
- * A third hook, `finalizeRequest`, was added here for `commands.sendValidator` and then removed: the
239
- * deep merge assigns function values directly and skips `undefined`, so the override it called reached
240
- * the same answer on every layer shape — a later layer that stays silent cannot erase an earlier
241
- * choice, because a merge only writes keys that are present.
242
- */
243
215
  private readonly configController: ConfigController<
244
216
  MessageComposerConfig,
245
217
  DeepPartial<MessageComposerConfig>
@@ -256,7 +228,6 @@ export class MessageComposer extends WithSubscriptions {
256
228
 
257
229
  this.compositionContext = compositionContext;
258
230
 
259
- // channel is easily inferable from the context
260
231
  if (compositionContext instanceof Channel) {
261
232
  this.channel = compositionContext;
262
233
  } else if (compositionContext instanceof Thread) {
@@ -278,7 +249,7 @@ export class MessageComposer extends WithSubscriptions {
278
249
  constructorOptions: config as Partial<MessageComposerConfig> | undefined,
279
250
  initialSlice: this.declarativeConfig as Partial<MessageComposerConfig> | undefined,
280
251
  mergeSlice: 'deep',
281
- // Stages 4 and 5 both arrive through `updateConfig`, and both have to outlive a re-resolution.
252
+ // A stored `false` cannot say whether the client or the server turned a feature off.
282
253
  retainPatches: true,
283
254
  applyAuthority: (requested) =>
284
255
  deepFreezeConfig(
@@ -338,14 +309,6 @@ export class MessageComposer extends WithSubscriptions {
338
309
 
339
310
  static generateId = generateUUIDv4;
340
311
 
341
- /**
342
- * The current resolved configuration.
343
- *
344
- * `Readonly` for the same reason every other configurable class's getter is: the value is the store's
345
- * live object, so assigning to a field would change state while notifying nobody. Use
346
- * {@link updateConfig}. `Readonly` is shallow, so nested writes are caught at runtime instead — the
347
- * whole resolution is deep-frozen by {@link resolvedConfig}, not only the untouched defaults.
348
- */
349
312
  get config(): Readonly<MessageComposerConfig> {
350
313
  return this.configState.getLatestValue();
351
314
  }
@@ -388,7 +351,6 @@ export class MessageComposer extends WithSubscriptions {
388
351
  return this.compositionContext.id;
389
352
  }
390
353
 
391
- // check if the message is a reply, get parentMessageId
392
354
  if (typeof this.compositionContext.parent_id === 'string') {
393
355
  return this.compositionContext.parent_id;
394
356
  }
@@ -471,22 +433,14 @@ export class MessageComposer extends WithSubscriptions {
471
433
  return !currentCommand || this.validateCommandSendability(currentCommand).ready;
472
434
  }
473
435
 
474
- /**
475
- * Whether a message may be sent while its attachments are still uploading — see
476
- * {@link AttachmentManagerConfig.pendingUploadsEnabled}.
477
- */
436
+ /** See {@link AttachmentManagerConfig.pendingUploadsEnabled}. */
478
437
  get allowsPendingUploads() {
479
438
  return this.attachmentManager.config.pendingUploadsEnabled;
480
439
  }
481
440
 
482
441
  /**
483
- * Where a composed message goes: the thread when this composer belongs to one, the channel
484
- * otherwise.
485
- *
486
- * Thread replies live in `thread.messagePaginator`, which is independent of the channel's, so
487
- * dispatching to the wrong one leaves the reply invisible where it was written. An edit composer
488
- * is built from the message rather than from its thread, so it finds the thread only when
489
- * `client.threads` has it registered — listed, or active (open somewhere).
442
+ * The thread when this composer belongs to one, else the channel. An edit composer finds its thread
443
+ * only if `client.threads` has it registered (listed or active).
490
444
  */
491
445
  get defaultSubmitTarget(): Channel | Thread {
492
446
  if (this.compositionContext instanceof Thread) return this.compositionContext;
@@ -496,11 +450,8 @@ export class MessageComposer extends WithSubscriptions {
496
450
  }
497
451
 
498
452
  /**
499
- * Whether submitting keeps the composer's contents rather than clearing them - see
500
- * {@link MessageComposerConfig.retainCompositionOnSubmit}.
501
- *
502
- * Read by the attachments composition step too: content the composer keeps must not also ride
503
- * along on the submitted message, or one `localMetadata.id` ends up owned in two places.
453
+ * See {@link MessageComposerConfig.retainCompositionOnSubmit}. The attachments composition step reads
454
+ * it too, so retained content is not also sent on the message.
504
455
  */
505
456
  get retainsCompositionOnSubmit() {
506
457
  return this.config.retainCompositionOnSubmit(this);
@@ -510,13 +461,8 @@ export class MessageComposer extends WithSubscriptions {
510
461
  if (!this.isCommandSendable) return false;
511
462
 
512
463
  if (this.allowsPendingUploads) {
513
- // An upload in flight is no longer a blocker, and a pending attachment counts as content
514
- // in its own right — otherwise an attachment-only message could never be sent before its
515
- // upload finished, which is the point of the flow. A `failed` one counts too: it rides
516
- // along on the optimistic message, where `settlePendingAttachmentUploads` retries it.
517
- // `blocked` still does not — the server's upload configuration refused it, so no retry can
518
- // settle it, and a message whose only attachment was rejected outright must not look
519
- // sendable.
464
+ // Uploads in flight do not block. Pending attachments count as content (settled on send), so
465
+ // do `failed` ones (retried on send). `blocked` ones do not (no retry can settle them).
520
466
  const hasSendableAttachment = this.attachmentManager.attachments.some(
521
467
  (attachment) =>
522
468
  isFinishedUpload(attachment) ||
@@ -558,7 +504,7 @@ export class MessageComposer extends WithSubscriptions {
558
504
  const initiatedWithoutDraft = this.lastChange.draftUpdate === null;
559
505
  const composingMessageFromScratch = initiatedWithoutDraft && !this.editedMessage;
560
506
 
561
- // does not mean that the original edited message is different from the current state
507
+ // Does not imply the edited message differs from the current state.
562
508
  const editedMessageWasUpdated =
563
509
  this.editedMessage?.updated_at != null &&
564
510
  this.editedMessage.updated_at < this.lastChange.stateUpdate;
@@ -570,24 +516,12 @@ export class MessageComposer extends WithSubscriptions {
570
516
  return editedMessageWasUpdated || draftWasChanged || composingMessageFromScratch;
571
517
  }
572
518
 
573
- /**
574
- * Records a configuration change as something *you* asked for, then republishes.
575
- *
576
- * The patch is kept — see {@link imperativeConfig} — rather than merged into the published result and
577
- * forgotten. That is what makes the request survive a later re-resolution, including one triggered by
578
- * the server changing its mind.
579
- */
519
+ /** The patch is retained, so it survives later re-resolutions (e.g. a server change). */
580
520
  updateConfig(config: DeepPartial<MessageComposerConfig>) {
581
521
  this.configController.patch(config as Partial<MessageComposerConfig>);
582
522
  }
583
523
 
584
- /**
585
- * What this composer has been **asked** for, before the server has any say — stages 1 to 5 of
586
- * `docs/instance-configuration.md` §3.
587
- *
588
- * Available on every entity that retains its patches, not just this one: it is the controller's, and
589
- * the split it exposes is what **FU-35** would extend elsewhere by switching on `retainPatches`.
590
- */
524
+ /** The config as requested, before server restrictions (`docs/instance-configuration.md` §3). */
591
525
  get requestedConfig(): Readonly<MessageComposerConfig> {
592
526
  return this.configController.requested;
593
527
  }
@@ -599,23 +533,9 @@ export class MessageComposer extends WithSubscriptions {
599
533
  }
600
534
 
601
535
  /**
602
- * The configuration fields this composer's channel decides server-side.
603
- *
604
- * Reading them is the composer's job rather than the shared helper's: only the composer knows that
605
- * `location.enabled` is gated on `shared_locations`, and only an existing composer has a channel to
606
- * ask. `serverConfig` is re-read on every call, so a restriction that changes mid-session is picked up
607
- * rather than captured once.
608
- *
609
- * Every entry here is a boolean gate, so `mergeServerRestrictions` ANDs it with what was requested and
610
- * either side may switch the feature off — a client asking for less than the server grants is always
611
- * legitimate. That is the whole point of mirroring these flags into configuration rather than leaving
612
- * consumers to read `serverConfig` themselves: a raw server flag answers only the server's half, so a UI
613
- * reading it offers features the composer has already disabled and would refuse to compose.
614
- *
615
- * `commands` is deliberately absent. The server sends a *list* of commands rather than a gate, so there
616
- * is nothing to AND and no integrator intent to mirror; consumers read it from the channel's config.
617
- *
618
- * Takes the requested configuration because one restriction is conditional — see `uploads` below.
536
+ * Server-side gates from the channel config, re-read on every call. Each is a boolean that
537
+ * `mergeServerRestrictions` ANDs with the request. `commands` is absent (the server sends a list,
538
+ * not a gate).
619
539
  */
620
540
  private serverRestrictionsFor(
621
541
  requested: MessageComposerConfig,
@@ -623,21 +543,8 @@ export class MessageComposer extends WithSubscriptions {
623
543
  const channelConfig = this.channel.serverConfig;
624
544
 
625
545
  return {
626
- /**
627
- * `uploads` describes **Stream's upload endpoint**, not the concept of attaching files. Setting
628
- * `attachments.customCdn` says the bytes go to storage Stream neither hosts nor charges for, and
629
- * the flag says nothing about whether that can work — applying it there would make "turn uploads
630
- * on in Stream" a precondition for uploading to your own CDN, which is not this SDK's to require.
631
- *
632
- * Keyed on `customCdn` rather than on the presence of `doUploadRequest`: a custom upload function
633
- * says how files are sent, not where, and one that still posts to Stream must stay subject to
634
- * Stream's rules.
635
- *
636
- * `undefined` rather than `true`: the server is not asserting the opposite either, it simply has
637
- * no say. `mergeServerRestrictions` leaves the request standing for a field it states nothing
638
- * about, so the integrator's `attachments.enabled` decides alone — the same way an unset
639
- * `shared_locations` behaves.
640
- */
546
+ // `uploads` governs Stream's upload endpoint, so it does not apply with `customCdn`. `undefined`
547
+ // leaves the request standing.
641
548
  attachments: {
642
549
  enabled: requested.attachments.customCdn ? undefined : channelConfig?.uploads,
643
550
  },
@@ -647,14 +554,7 @@ export class MessageComposer extends WithSubscriptions {
647
554
  };
648
555
  }
649
556
 
650
- /**
651
- * Ceilings this composer's channel imposes server-side.
652
- *
653
- * `max_message_length` caps both length limits rather than setting them: a composer asking for something
654
- * shorter keeps its own number, and one asking for nothing at all inherits the server's — which is the
655
- * default, and the case worth having. Left unlimited, the composer happily accepts text the send endpoint
656
- * then rejects, so the limit is enforced late and as an API error instead of in the editor.
657
- */
557
+ /** `max_message_length` caps both length limits: a smaller requested value wins, unset inherits it. */
658
558
  private get serverUpperBounds(): ServerUpperBounds<MessageComposerConfig> {
659
559
  const maxMessageLength = this.channel.serverConfig?.max_message_length;
660
560
 
@@ -663,52 +563,23 @@ export class MessageComposer extends WithSubscriptions {
663
563
  };
664
564
  }
665
565
 
666
- /**
667
- * Resolves the configuration and publishes it, unless the result is deep-equal to what is already there.
668
- *
669
- * The guard is needed because `StateStore.next`'s own `===` no-op can never apply here: every resolution
670
- * allocates a new object, so without a comparison *every* publish notifies, whether or not any value
671
- * moved.
672
- *
673
- * Worth the walk: `isEqual` over a resolved composer config measures ~1.7µs, against a resolution at
674
- * ~3.5µs plus every subscriber's work. The dominant source of no-op publishes is fixed upstream in
675
- * `StreamChat._addChannelConfig`, which stops a repeated channel query from waking that channel's
676
- * composer at all; this
677
- * catches the rest — re-registering a declarative value that has not changed, a `reset` with nothing
678
- * registered, an empty `updateConfig({})`.
679
- */
566
+ // The controller skips the publish when the resolved config is deep-equal to the last one.
680
567
  private publishConfig = () => {
681
568
  this.configController.rederive(this.declarativeConfig);
682
569
  };
683
570
 
684
571
  /**
685
- * Rebuilds the configuration from its inputs and **discards imperative changes** — every
686
- * {@link updateConfig} patch, including those made through a sub-composer setter such as
687
- * `textComposer.defaultValue` or `attachmentManager.maxNumberOfFilesPerMessage`.
688
- *
689
- * Called by the constructor and by `client.config.reset()`, where dropping them is the point: a reset
690
- * means "back to what is registered". Anything that merely needs the configuration re-resolved — the
691
- * server's answer arriving, a declarative change — must use {@link publishConfig} or
692
- * {@link applyServerRestrictions}, which keep them.
572
+ * Rebuilds the configuration from its inputs and **discards every {@link updateConfig} patch**,
573
+ * including those from sub-composer setters. To re-resolve and keep them, use
574
+ * {@link applyServerRestrictions}.
693
575
  */
694
576
  initializeConfig = () => {
695
577
  this.configController.initialize(this.declarativeConfig);
696
578
  };
697
579
 
698
580
  /**
699
- * Re-resolves the configuration against the channel's current server-side restrictions.
700
- *
701
- * Call this when the server's answer may have changed — its config has just arrived, or it was updated.
702
- * Safe in both directions, which is the whole reason it exists: a feature you disabled stays disabled
703
- * when the server permits it, and a feature the server *stops* restricting goes back to whatever you
704
- * asked for, because the restriction is applied to your request rather than to the previous result.
705
- *
706
- * Reachable rather than public: `Channel.query` is the only caller, covering a composer that has not
707
- * registered subscriptions and so cannot hear the answer change through
708
- * {@link subscribeChannelConfigChanged}. Nothing outside this package needs it — registering subscriptions
709
- * is the supported way to stay current, and a composer that has done so is already covered. Marked
710
- * `@internal` so it is not read as a supported extension point; the name is kept because what it does
711
- * is* re-assert the server's restrictions, even though the whole resolution is what performs that.
581
+ * Re-resolves the configuration against the channel's current server-side restrictions, keeping
582
+ * `updateConfig` patches. `Channel.query` calls it for composers without registered subscriptions.
712
583
  *
713
584
  * @internal
714
585
  */
@@ -753,7 +624,7 @@ export class MessageComposer extends WithSubscriptions {
753
624
  (db) =>
754
625
  db.deleteDraft({
755
626
  cid: this.channel.cid,
756
- parent_id: undefined, // makes sure that we don't delete thread drafts while upserting channels
627
+ parent_id: undefined, // keeps thread drafts when upserting channels
757
628
  }),
758
629
  { method: 'deleteDraft' },
759
630
  );
@@ -787,10 +658,8 @@ export class MessageComposer extends WithSubscriptions {
787
658
  };
788
659
 
789
660
  /**
790
- * Moves this composition into `target`, replacing what `target` held, and clears this composer
791
- * locally: the text, attachments, poll, location, link previews, custom data, quoted message and
792
- * reply-in-channel choice. An upload still running keeps running and its result lands in `target`
793
- * (see {@link AttachmentManager.takeOver}). Nothing is sent.
661
+ * Moves this composition into `target`, replacing what `target` held, and clears this composer.
662
+ * Running uploads continue into `target` (see {@link AttachmentManager.takeOver}). Nothing is sent.
794
663
  *
795
664
  * @internal
796
665
  */
@@ -900,24 +769,13 @@ export class MessageComposer extends WithSubscriptions {
900
769
  args: { composer: this },
901
770
  config: this.client.config,
902
771
  key: 'messageComposer',
903
- // Re-resolve rather than merge the slice in. `requestedConfig` reads the declarative slice live, so
904
- // there is nothing to copy — and copying it through `updateConfig` would file it under *imperative*
905
- // changes, letting a later declarative change override an imperative one. That inverts stages 2 and
906
- // 5 of the documented order, which says the more specific, later request wins.
772
+ // Re-resolve: copying the slice through `updateConfig` would make it an imperative patch.
907
773
  applyConfig: () => this.publishConfig(),
908
774
  reinitializeConfig: this.initializeConfig,
909
775
  });
910
776
 
911
- /**
912
- * The channel's server-side config (`client.channelServerConfigs[cid]`) is populated by `query`/`watch`,
913
- * which for a channel opened via `client.channelManager.ensure({ type, id })` happens *after* this composer was
914
- * constructed. Left unwatched, the composer would keep the defaults it derived when `serverConfig` was
915
- * still undefined — so `location.enabled` would stay `true` for an app that disables `shared_locations`
916
- * server-side. Re-deriving when the config lands keeps the server authoritative.
917
- *
918
- * Selected by cid, matching the store's key space: `shared_locations` and `max_message_length` are both
919
- * overridable per channel, so a sibling channel's config is not this composer's answer.
920
- */
777
+ // The channel's server config lands on `query`/`watch`, possibly after construction: re-resolve then.
778
+ // Selected by cid: the config is per channel.
921
779
  private subscribeChannelConfigChanged = () =>
922
780
  this.client.channelServerConfigsStore.subscribeWithSelector(
923
781
  ({ configs }) => ({ channelConfig: configs[this.channel.cid] }),
@@ -972,7 +830,7 @@ export class MessageComposer extends WithSubscriptions {
972
830
  this.textComposer.state.subscribeWithSelector(
973
831
  ({ text }) => [text] as const,
974
832
  ([currentText], previousSelection) => {
975
- // do not handle on initial subscription
833
+ // Skip the initial subscription call.
976
834
  if (typeof previousSelection === 'undefined') return;
977
835
 
978
836
  this.logStateUpdateTimestamp();
@@ -1133,8 +991,8 @@ export class MessageComposer extends WithSubscriptions {
1133
991
  },
1134
992
  localMessage: {
1135
993
  attachments: [] as Attachment[],
1136
- cid: this.channel.cid, // it is needed to match local paginator filters to be ingested into its state
1137
- created_at, // only assigned to localMessage as this is used for optimistic update
994
+ cid: this.channel.cid, // needed to match local paginator filters
995
+ created_at, // only on `localMessage`, for the optimistic update
1138
996
  deleted_at: undefined,
1139
997
  error: undefined,
1140
998
  id: this.id,
@@ -1174,9 +1032,8 @@ export class MessageComposer extends WithSubscriptions {
1174
1032
  };
1175
1033
 
1176
1034
  createDraft = async () => {
1177
- // server-side drafts are not stored on message level but on thread and channel level
1178
- // therefore we don't need to create a draft if the message is edited
1179
- // nor for a channel without an id yet: there is nothing to save it for (see `isProvisional`)
1035
+ // Server drafts live on the thread or channel, not on a message, so none for an edit. Nor for a
1036
+ // provisional channel (no ID yet).
1180
1037
  if (this.editedMessage || !this.config.drafts.enabled || this.channel.isProvisional)
1181
1038
  return;
1182
1039
  const composition = await this.composeDraft();
@@ -1292,26 +1149,13 @@ export class MessageComposer extends WithSubscriptions {
1292
1149
  }
1293
1150
  };
1294
1151
 
1295
- /**
1296
- * Lets go of what the submitted message took with it.
1297
- *
1298
- * A poll message carries no text or attachments of its own, so the composer keeps whatever else
1299
- * was drafted and releases only the poll. Everything else is a full clear.
1300
- */
1152
+ /** Clears the composer, or only detaches the poll when `retainsCompositionOnSubmit`. */
1301
1153
  private releaseSubmittedComposition = () => {
1302
1154
  if (this.retainsCompositionOnSubmit) {
1303
1155
  this.state.partialNext({
1304
1156
  id: MessageComposer.generateId(),
1305
- // Unconditional, and safe whatever decided to retain: a poll that exists is always a poll
1306
- // that just went out, because `createMessageComposerStateCompositionMiddleware` copies a
1307
- // set `pollId` onto every composition - threads and edits included, where the poll-only
1308
- // middleware forwards. There is no state where this detaches one the submission did not
1309
- // carry.
1310
- //
1311
- // Detaching it is also not optional. While `pollId` is set, `hasSendableData` counts it as
1312
- // content on its own and `createPollOnlyCompositionMiddleware` turns every composition
1313
- // into a poll-only message, so a composer left bound to a spent poll nullifies whatever is
1314
- // typed next and re-sends the same poll.
1157
+ // Always detached: a set `pollId` is copied onto every composition, so it just went out. Left
1158
+ // set, `createPollOnlyCompositionMiddleware` would turn the next message into the same poll.
1315
1159
  pollId: null,
1316
1160
  });
1317
1161
  return;
@@ -1340,12 +1184,8 @@ export class MessageComposer extends WithSubscriptions {
1340
1184
  };
1341
1185
 
1342
1186
  /**
1343
- * Composes the message and sends it, releasing the composer as it goes.
1344
- *
1345
- * Never rejects - see {@link MessageComposerSubmitResult} for what each outcome means and where
1346
- * the content ends up. A failure is reported through `client.notifications`, and the message
1347
- * stays in the list marked `failed`, which is where the user retries it. Callers rendering their
1348
- * own post-send feedback have to check the result.
1187
+ * Composes and sends the message. Never rejects: see {@link MessageComposerSubmitResult}. A failure is
1188
+ * reported through `client.notifications`.
1349
1189
  */
1350
1190
  send = async (): Promise<MessageComposerSubmitResult> => {
1351
1191
  const composition = await this.compose();
@@ -1353,9 +1193,7 @@ export class MessageComposer extends WithSubscriptions {
1353
1193
 
1354
1194
  const { localMessage, message, sendOptions } = composition;
1355
1195
 
1356
- // Released before the request, not after. The request lasts a round trip - longer still when it
1357
- // waits for an upload to settle - and clearing at the end leaves that whole window for the
1358
- // user's next keystrokes to race the clear.
1196
+ // Released before the request, so the user's next keystrokes cannot race the clear.
1359
1197
  this.releaseSubmittedComposition();
1360
1198
 
1361
1199
  try {
@@ -1366,9 +1204,7 @@ export class MessageComposer extends WithSubscriptions {
1366
1204
  });
1367
1205
  return 'sent';
1368
1206
  } catch (error) {
1369
- // Nothing is put back. The message is already in the list marked `failed` with a retry
1370
- // affordance, so restoring here would leave the same content - and the same attachment upload
1371
- // ids - owned in two places, where sending either copy corrupts the other.
1207
+ // Nothing is restored: the failed message in the list owns the content and its upload IDs.
1372
1208
  this.reportSubmitFailure(
1373
1209
  CORE_NOTIFICATION_TYPE.messageSendFailed,
1374
1210
  'Send message request failed',
@@ -1378,10 +1214,7 @@ export class MessageComposer extends WithSubscriptions {
1378
1214
  }
1379
1215
  };
1380
1216
 
1381
- /**
1382
- * Composes the edit and saves it, on the same terms as {@link send} - including releasing the
1383
- * composer before the request rather than after it.
1384
- */
1217
+ /** Composes and saves the edit, on the same terms as {@link send}. */
1385
1218
  update = async (): Promise<MessageComposerSubmitResult> => {
1386
1219
  const composition = await this.compose();
1387
1220
  if (!composition?.message) return 'nothing-to-send';
@@ -1397,8 +1230,7 @@ export class MessageComposer extends WithSubscriptions {
1397
1230
  });
1398
1231
  return 'sent';
1399
1232
  } catch (error) {
1400
- // As in `send`: the edit is kept on the message and marked failed, so there is nothing to
1401
- // restore here.
1233
+ // As in `send`: nothing is restored.
1402
1234
  this.reportSubmitFailure(
1403
1235
  CORE_NOTIFICATION_TYPE.messageUpdateFailed,
1404
1236
  'Edit message request failed',
@@ -10,20 +10,10 @@ import type { LocalNotImageAttachment } from '../../../types';
10
10
  /**
11
11
  * Writes the uploaded URL onto the attachment and releases its local preview.
12
12
  *
13
- * The preview is a blob URL the composer created for the file. Releasing it once the CDN URL is
14
- * in is what keeps the browser from holding the file in memory.
15
- *
16
- * Pass `composer` and the preview is released only while the attachment is still one of the
17
- * composer's own — still listed in `attachmentManager.attachments`, i.e. still shown above the
18
- * input, waiting to be sent.
19
- *
20
- * This runs when an upload finishes, which can be after the composer was cleared: `uploadFile`
21
- * executes this chain before the (by then no-op) `updateAttachment`. If the attachment is gone
22
- * from the composer, a message is rendering from the preview instead, and releasing it would
23
- * blank that message out. A message can be sent with uploads still running — see
24
- * {@link AttachmentManagerConfig.pendingUploadsEnabled}.
25
- *
26
- * Omit `composer` and the preview is always released.
13
+ * With `composer`, the preview is released only while the attachment is still in
14
+ * `attachmentManager.attachments`: an upload can finish after the composer was cleared (see
15
+ * {@link AttachmentManagerConfig.pendingUploadsEnabled}), and a sent message may still render from it.
16
+ * Without `composer`, it is always released.
27
17
  */
28
18
  export const createPostUploadAttachmentEnrichmentMiddleware = (
29
19
  composer?: MessageComposer,
@@ -42,8 +32,6 @@ export const createPostUploadAttachmentEnrichmentMiddleware = (
42
32
 
43
33
  const enrichedAttachment = { ...attachment };
44
34
  const { id, previewUri } = attachment.localMetadata;
45
- // `attachmentsById` is built from the composer's current attachment state, so a hit means
46
- // the attachment is still in the composer and its preview is not in use elsewhere.
47
35
  const attachmentIsStillInComposer =
48
36
  !composer || !!composer.attachmentManager.attachmentsById[id];
49
37
 
@@ -20,8 +20,7 @@ export const createUploadErrorHandlerMiddleware = (
20
20
  const { attachment, error } = state;
21
21
  if (!error) return forward();
22
22
  if (!attachment) return discard();
23
- // A cancellation is the user getting what they asked for, so it gets no error
24
- // notification. `ApiClient.doAxiosRequest` draws the same line for the same reason.
23
+ // A cancellation is not an error: no notification.
25
24
  if (isUploadCancellation(error)) return forward();
26
25
 
27
26
  const reason = error instanceof Error ? error.message : 'unknown error';