stream-chat-react-native-core 9.11.0 → 9.11.1-beta.1

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 (46) hide show
  1. package/lib/commonjs/components/MessageList/MessageFlashList.js +38 -6
  2. package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
  3. package/lib/commonjs/components/MessageList/MessageList.js +16 -4
  4. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  5. package/lib/commonjs/store/apis/getChannelMessages.js +5 -3
  6. package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
  7. package/lib/commonjs/store/apis/getChannels.js +6 -3
  8. package/lib/commonjs/store/apis/getChannels.js.map +1 -1
  9. package/lib/commonjs/store/apis/getChannelsForFilterSort.js +2 -1
  10. package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
  11. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +7 -5
  12. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  13. package/lib/commonjs/version.json +1 -1
  14. package/lib/module/components/MessageList/MessageFlashList.js +38 -6
  15. package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
  16. package/lib/module/components/MessageList/MessageList.js +16 -4
  17. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  18. package/lib/module/store/apis/getChannelMessages.js +5 -3
  19. package/lib/module/store/apis/getChannelMessages.js.map +1 -1
  20. package/lib/module/store/apis/getChannels.js +6 -3
  21. package/lib/module/store/apis/getChannels.js.map +1 -1
  22. package/lib/module/store/apis/getChannelsForFilterSort.js +2 -1
  23. package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
  24. package/lib/module/store/apis/queries/selectMessagesForChannels.js +7 -5
  25. package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  26. package/lib/module/version.json +1 -1
  27. package/lib/typescript/components/MessageList/MessageFlashList.d.ts +1 -1
  28. package/lib/typescript/components/MessageList/MessageFlashList.d.ts.map +1 -1
  29. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  30. package/lib/typescript/store/apis/getChannelMessages.d.ts +2 -1
  31. package/lib/typescript/store/apis/getChannelMessages.d.ts.map +1 -1
  32. package/lib/typescript/store/apis/getChannels.d.ts +3 -1
  33. package/lib/typescript/store/apis/getChannels.d.ts.map +1 -1
  34. package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts.map +1 -1
  35. package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts +3 -1
  36. package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/components/MessageList/MessageFlashList.tsx +58 -8
  39. package/src/components/MessageList/MessageList.tsx +22 -5
  40. package/src/components/MessageList/__tests__/MessageList.test.tsx +51 -0
  41. package/src/store/__tests__/selectMessagesForChannels.test.ts +63 -0
  42. package/src/store/apis/getChannelMessages.ts +4 -1
  43. package/src/store/apis/getChannels.ts +5 -1
  44. package/src/store/apis/getChannelsForFilterSort.ts +1 -0
  45. package/src/store/apis/queries/selectMessagesForChannels.ts +7 -2
  46. package/src/version.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_getChannelActiveLocations","require","_getChannelMessages","_getDraftsForChannels","_getMembers","_getReads","_selectChannels","_mapStorableToChannel","_SqliteClient","getChannels","exports","_ref","_asyncToGenerator2","default","channelIds","currentUserId","SqliteClient","logger","_yield$Promise$all","Promise","all","selectChannels","getDraftForChannels","getMembers","getReads","getChannelMessages","getChannelActiveLocations","_yield$Promise$all2","_slicedToArray2","channels","cidVsDraft","cidVsMembers","cidVsReads","cidVsMessages","cidVsActiveLocations","map","c","mapStorableToChannel","active_live_locations","cid","draft","members","membership","find","member","user_id","messages","pinned_messages","read","_x","apply","arguments"],"sourceRoot":"../../../../src","sources":["store/apis/getChannels.ts"],"mappings":";;;;;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAC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AC,CAACG,GAAG,CAAC,IAAI,EAAE;MACxDC,KAAK,EAAEV,UAAU,CAACM,CAAC,CAACG,GAAG,CAAC;MACxBE,OAAO,EAAEV,YAAY,CAACK,CAAC,CAACG,GAAG,CAAC,IAAI,EAAE;MAClCG,UAAU,EAAE,CAACX,YAAY,CAACK,CAAC,CAACG,GAAG,CAAC,IAAI,EAAE,EAAEI,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,OAAO,KAAK9B,aAAa,CAAC;MAC1F+B,QAAQ,EAAEb,aAAa,CAACG,CAAC,CAACG,GAAG,CAAC,IAAI,EAAE;MACpCQ,eAAe,EAAE,EAAE;MACnBC,IAAI,EAAEhB,UAAU,CAACI,CAAC,CAACG,GAAG,CAAC,IAAI;IAC7B,CAAC,CAAC,CAAC;EACL,CAAC;EAAA,gBAjCY9B,WAAWA,CAAAwC,EAAA;IAAA,OAAAtC,IAAA,CAAAuC,KAAA,OAAAC,SAAA;EAAA;AAAA,GAiCvB","ignoreList":[]}
1
+ {"version":3,"names":["_getChannelActiveLocations","require","_getChannelMessages","_getDraftsForChannels","_getMembers","_getReads","_selectChannels","_mapStorableToChannel","_SqliteClient","getChannels","exports","_ref","_asyncToGenerator2","default","channelIds","currentUserId","messageLimit","SqliteClient","logger","_yield$Promise$all","Promise","all","selectChannels","getDraftForChannels","getMembers","getReads","getChannelMessages","getChannelActiveLocations","_yield$Promise$all2","_slicedToArray2","channels","cidVsDraft","cidVsMembers","cidVsReads","cidVsMessages","cidVsActiveLocations","map","c","mapStorableToChannel","active_live_locations","cid","draft","members","membership","find","member","user_id","messages","pinned_messages","read","_x","apply","arguments"],"sourceRoot":"../../../../src","sources":["store/apis/getChannels.ts"],"mappings":";;;;;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA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CAACM,CAAC,CAACG,GAAG,CAAC;MACxBE,OAAO,EAAEV,YAAY,CAACK,CAAC,CAACG,GAAG,CAAC,IAAI,EAAE;MAClCG,UAAU,EAAE,CAACX,YAAY,CAACK,CAAC,CAACG,GAAG,CAAC,IAAI,EAAE,EAAEI,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,OAAO,KAAK/B,aAAa,CAAC;MAC1FgC,QAAQ,EAAEb,aAAa,CAACG,CAAC,CAACG,GAAG,CAAC,IAAI,EAAE;MACpCQ,eAAe,EAAE,EAAE;MACnBC,IAAI,EAAEhB,UAAU,CAACI,CAAC,CAACG,GAAG,CAAC,IAAI;IAC7B,CAAC,CAAC,CAAC;EACL,CAAC;EAAA,gBApCY/B,WAAWA,CAAAyC,EAAA;IAAA,OAAAvC,IAAA,CAAAwC,KAAA,OAAAC,SAAA;EAAA;AAAA,GAoCvB","ignoreList":[]}
@@ -36,7 +36,8 @@ var getChannelsForFilterSort = exports.getChannelsForFilterSort = function () {
36
36
  }
37
37
  return yield (0, _getChannels.getChannels)({
38
38
  channelIds,
39
- currentUserId
39
+ currentUserId,
40
+ messageLimit: options == null ? void 0 : options.message_limit
40
41
  });
41
42
  });
42
43
  return function getChannelsForFilterSort(_x) {
@@ -1 +1 @@
1
- {"version":3,"names":["_getChannels","require","_selectChannelIdsForFilterSort","_SqliteClient","getChannelsForFilterSort","exports","_ref","_asyncToGenerator2","default","currentUserId","filters","options","sort","predefined_filter","console","warn","SqliteClient","logger","channelIds","selectChannelIdsForFilterSort","length","getChannels","_x","apply","arguments"],"sourceRoot":"../../../../src","sources":["store/apis/getChannelsForFilterSort.ts"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAYO,IAAMG,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA;EAAA,IAAAE,IAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAG,WAAO;IAC7CC,aAAa;IACbC,OAAO;IACPC,OAAO;IACPC;EAMF,CAAC,EAA6D;IAC5D,IAAI,CAACF,OAAO,IAAI,CAACE,IAAI,IAAI,EAACD,OAAO,YAAPA,OAAO,CAAEE,iBAAiB,GAAE;MACpDC,OAAO,CAACC,IAAI,CACV,kGACF,CAAC;MACD,OAAO,IAAI;IACb;IAEAC,0BAAY,CAACC,MAAM,YAAnBD,0BAAY,CAACC,MAAM,CAAG,MAAM,EAAE,0BAA0B,EAAE;MAAEP,OAAO;MAAEC,OAAO;MAAEC;IAAK,CAAC,CAAC;IAErF,IAAMM,UAAU,SAAS,IAAAC,4DAA6B,EAAC;MAAET,OAAO;MAAEC,OAAO;MAAEC;IAAK,CAAC,CAAC;IAElF,IAAI,CAACM,UAAU,EAAE;MACf,OAAO,IAAI;IACb;IAEA,IAAIA,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;MAC3B,OAAO,EAAE;IACX;IAEA,aAAa,IAAAC,wBAAW,EAAC;MACvBH,UAAU;MACVT;IACF,CAAC,CAAC;EACJ,CAAC;EAAA,gBAlCYL,wBAAwBA,CAAAkB,EAAA;IAAA,OAAAhB,IAAA,CAAAiB,KAAA,OAAAC,SAAA;EAAA;AAAA,GAkCpC","ignoreList":[]}
1
+ {"version":3,"names":["_getChannels","require","_selectChannelIdsForFilterSort","_SqliteClient","getChannelsForFilterSort","exports","_ref","_asyncToGenerator2","default","currentUserId","filters","options","sort","predefined_filter","console","warn","SqliteClient","logger","channelIds","selectChannelIdsForFilterSort","length","getChannels","messageLimit","message_limit","_x","apply","arguments"],"sourceRoot":"../../../../src","sources":["store/apis/getChannelsForFilterSort.ts"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAYO,IAAMG,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA;EAAA,IAAAE,IAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAG,WAAO;IAC7CC,aAAa;IACbC,OAAO;IACPC,OAAO;IACPC;EAMF,CAAC,EAA6D;IAC5D,IAAI,CAACF,OAAO,IAAI,CAACE,IAAI,IAAI,EAACD,OAAO,YAAPA,OAAO,CAAEE,iBAAiB,GAAE;MACpDC,OAAO,CAACC,IAAI,CACV,kGACF,CAAC;MACD,OAAO,IAAI;IACb;IAEAC,0BAAY,CAACC,MAAM,YAAnBD,0BAAY,CAACC,MAAM,CAAG,MAAM,EAAE,0BAA0B,EAAE;MAAEP,OAAO;MAAEC,OAAO;MAAEC;IAAK,CAAC,CAAC;IAErF,IAAMM,UAAU,SAAS,IAAAC,4DAA6B,EAAC;MAAET,OAAO;MAAEC,OAAO;MAAEC;IAAK,CAAC,CAAC;IAElF,IAAI,CAACM,UAAU,EAAE;MACf,OAAO,IAAI;IACb;IAEA,IAAIA,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;MAC3B,OAAO,EAAE;IACX;IAEA,aAAa,IAAAC,wBAAW,EAAC;MACvBH,UAAU;MACVT,aAAa;MACba,YAAY,EAAEX,OAAO,oBAAPA,OAAO,CAAEY;IACzB,CAAC,CAAC;EACJ,CAAC;EAAA,gBAnCYnB,wBAAwBA,CAAAoB,EAAA;IAAA,OAAAlB,IAAA,CAAAmB,KAAA,OAAAC,SAAA;EAAA;AAAA,GAmCpC","ignoreList":[]}
@@ -2,17 +2,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.selectMessagesForChannels = void 0;
5
+ exports.selectMessagesForChannels = exports.DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT = void 0;
6
6
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
7
7
  var _schema = require("../../schema");
8
8
  var _SqliteClient = require("../../SqliteClient");
9
+ var DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT = exports.DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT = 25;
9
10
  var selectMessagesForChannels = exports.selectMessagesForChannels = function () {
10
- var _ref = (0, _asyncToGenerator2.default)(function* (cids) {
11
+ var _ref = (0, _asyncToGenerator2.default)(function* (cids, messageLimit = DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT) {
11
12
  var questionMarks = Array(cids.length).fill('?').join(',');
12
13
  var messagesColumnNames = Object.keys(_schema.tables.messages.columns).map(name => `'${name}', a.${name}`).join(', ');
13
14
  var userColumnNames = Object.keys(_schema.tables.users.columns).map(name => `'${name}', b.${name}`).join(', ');
14
15
  _SqliteClient.SqliteClient.logger == null || _SqliteClient.SqliteClient.logger('info', 'selectMessagesForChannels', {
15
- cids
16
+ cids,
17
+ messageLimit
16
18
  });
17
19
  var result = yield _SqliteClient.SqliteClient.executeSql(`SELECT
18
20
  json_object(
@@ -34,8 +36,8 @@ var selectMessagesForChannels = exports.selectMessagesForChannels = function ()
34
36
  LEFT JOIN
35
37
  users b
36
38
  ON b.id = a.userId
37
- WHERE RowNum < 25
38
- ORDER BY a.createdAt ASC`, cids);
39
+ WHERE RowNum <= ?
40
+ ORDER BY a.createdAt ASC`, [...cids, messageLimit]);
39
41
  return result.map(r => JSON.parse(r.value));
40
42
  });
41
43
  return function selectMessagesForChannels(_x) {
@@ -1 +1 @@
1
- {"version":3,"names":["_schema","require","_SqliteClient","selectMessagesForChannels","exports","_ref","_asyncToGenerator2","default","cids","questionMarks","Array","length","fill","join","messagesColumnNames","Object","keys","tables","messages","columns","map","name","userColumnNames","users","SqliteClient","logger","result","executeSql","r","JSON","parse","value","_x","apply","arguments"],"sourceRoot":"../../../../../src","sources":["store/apis/queries/selectMessagesForChannels.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGO,IAAME,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA;EAAA,IAAAE,IAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAG,WACvCC,IAAc,EACgC;IAC9C,IAAMC,aAAa,GAAGC,KAAK,CAACF,IAAI,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;IAC5D,IAAMC,mBAAmB,GAAGC,MAAM,CAACC,IAAI,CAACC,cAAM,CAACC,QAAQ,CAACC,OAAO,CAAC,CAC7DC,GAAG,CAAEC,IAAI,IAAK,IAAIA,IAAI,QAAQA,IAAI,EAAE,CAAC,CACrCR,IAAI,CAAC,IAAI,CAAC;IACb,IAAMS,eAAe,GAAGP,MAAM,CAACC,IAAI,CAACC,cAAM,CAACM,KAAK,CAACJ,OAAO,CAAC,CACtDC,GAAG,CAAEC,IAAI,IAAK,IAAIA,IAAI,QAAQA,IAAI,EAAE,CAAC,CACrCR,IAAI,CAAC,IAAI,CAAC;IAEbW,0BAAY,CAACC,MAAM,YAAnBD,0BAAY,CAACC,MAAM,CAAG,MAAM,EAAE,2BAA2B,EAAE;MACzDjB;IACF,CAAC,CAAC;IAEF,IAAMkB,MAAM,SAASF,0BAAY,CAACG,UAAU,CAC1C;AACJ;AACA;AACA,YAAYL,eAAe;AAC3B;AACA,UAAUR,mBAAmB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsBL,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA,6BAA6B,EACzBD,IACF,CAAC;IAED,OAAOkB,MAAM,CAACN,GAAG,CAAEQ,CAAC,IAAKC,IAAI,CAACC,KAAK,CAACF,CAAC,CAACG,KAAK,CAAC,CAAC;EAC/C,CAAC;EAAA,gBA1CY5B,yBAAyBA,CAAA6B,EAAA;IAAA,OAAA3B,IAAA,CAAA4B,KAAA,OAAAC,SAAA;EAAA;AAAA,GA0CrC","ignoreList":[]}
1
+ {"version":3,"names":["_schema","require","_SqliteClient","DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT","exports","selectMessagesForChannels","_ref","_asyncToGenerator2","default","cids","messageLimit","questionMarks","Array","length","fill","join","messagesColumnNames","Object","keys","tables","messages","columns","map","name","userColumnNames","users","SqliteClient","logger","result","executeSql","r","JSON","parse","value","_x","apply","arguments"],"sourceRoot":"../../../../../src","sources":["store/apis/queries/selectMessagesForChannels.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIO,IAAME,kCAAkC,GAAAC,OAAA,CAAAD,kCAAA,GAAG,EAAE;AAE7C,IAAME,yBAAyB,GAAAD,OAAA,CAAAC,yBAAA;EAAA,IAAAC,IAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAG,WACvCC,IAAc,EACdC,YAAoB,GAAGP,kCAAkC,EACX;IAC9C,IAAMQ,aAAa,GAAGC,KAAK,CAACH,IAAI,CAACI,MAAM,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;IAC5D,IAAMC,mBAAmB,GAAGC,MAAM,CAACC,IAAI,CAACC,cAAM,CAACC,QAAQ,CAACC,OAAO,CAAC,CAC7DC,GAAG,CAAEC,IAAI,IAAK,IAAIA,IAAI,QAAQA,IAAI,EAAE,CAAC,CACrCR,IAAI,CAAC,IAAI,CAAC;IACb,IAAMS,eAAe,GAAGP,MAAM,CAACC,IAAI,CAACC,cAAM,CAACM,KAAK,CAACJ,OAAO,CAAC,CACtDC,GAAG,CAAEC,IAAI,IAAK,IAAIA,IAAI,QAAQA,IAAI,EAAE,CAAC,CACrCR,IAAI,CAAC,IAAI,CAAC;IAEbW,0BAAY,CAACC,MAAM,YAAnBD,0BAAY,CAACC,MAAM,CAAG,MAAM,EAAE,2BAA2B,EAAE;MACzDlB,IAAI;MACJC;IACF,CAAC,CAAC;IAEF,IAAMkB,MAAM,SAASF,0BAAY,CAACG,UAAU,CAC1C;AACJ;AACA;AACA,YAAYL,eAAe;AAC3B;AACA,UAAUR,mBAAmB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsBL,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA,6BAA6B,EACzB,CAAC,GAAGF,IAAI,EAAEC,YAAY,CACxB,CAAC;IAED,OAAOkB,MAAM,CAACN,GAAG,CAAEQ,CAAC,IAAKC,IAAI,CAACC,KAAK,CAACF,CAAC,CAACG,KAAK,CAAC,CAAC;EAC/C,CAAC;EAAA,gBA5CY5B,yBAAyBA,CAAA6B,EAAA;IAAA,OAAA5B,IAAA,CAAA6B,KAAA,OAAAC,SAAA;EAAA;AAAA,GA4CrC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "9.11.0"
2
+ "version": "9.11.1-beta.1"
3
3
  }
@@ -10,7 +10,7 @@ import { MessagesContextValue } from '../../contexts/messagesContext/MessagesCon
10
10
  import { OwnCapabilitiesContextValue } from '../../contexts/ownCapabilitiesContext/OwnCapabilitiesContext';
11
11
  import { PaginatedMessageListContextValue } from '../../contexts/paginatedMessageListContext/PaginatedMessageListContext';
12
12
  import { ThreadContextValue } from '../../contexts/threadContext/ThreadContext';
13
- type MessageFlashListPropsWithContext = Pick<AttachmentPickerContextValue, 'closePicker' | 'attachmentPickerStore'> & Pick<OwnCapabilitiesContextValue, 'readEvents'> & Pick<ChannelContextValue, 'channel' | 'channelUnreadStateStore' | 'disabled' | 'hideStickyDateHeader' | 'highlightedMessageId' | 'loadChannelAroundMessage' | 'loading' | 'markRead' | 'reloadChannel' | 'scrollToFirstUnreadThreshold' | 'setChannelUnreadState' | 'setTargetedMessage' | 'hasPendingInitialTargetLoad' | 'targetedMessage' | 'threadList' | 'maximumMessageLimit'> & Pick<ChatContextValue, 'client'> & Pick<MessageInputContextValue, 'allowSendBeforeAttachmentsUpload' | 'messageInputFloating' | 'messageInputHeightStore'> & Pick<PaginatedMessageListContextValue, 'loadMore' | 'loadMoreRecent'> & Pick<MessagesContextValue, 'disableTypingIndicator' | 'FlatList' | 'myMessageTheme' | 'shouldShowUnreadUnderlay'> & Pick<ThreadContextValue, 'loadMoreRecentThread' | 'loadMoreThread' | 'thread' | 'threadInstance'> & {
13
+ type MessageFlashListPropsWithContext = Pick<AttachmentPickerContextValue, 'closePicker' | 'attachmentPickerStore'> & Pick<OwnCapabilitiesContextValue, 'readEvents'> & Pick<ChannelContextValue, 'channel' | 'channelUnreadStateStore' | 'disabled' | 'hideStickyDateHeader' | 'highlightedMessageId' | 'loadChannelAroundMessage' | 'loading' | 'markRead' | 'reloadChannel' | 'scrollToFirstUnreadThreshold' | 'setChannelUnreadState' | 'setTargetedMessage' | 'hasPendingInitialTargetLoad' | 'targetedMessage' | 'threadList' | 'maximumMessageLimit'> & Pick<ChatContextValue, 'client'> & Pick<MessageInputContextValue, 'allowSendBeforeAttachmentsUpload' | 'messageInputFloating' | 'messageInputHeightStore'> & Pick<PaginatedMessageListContextValue, 'loadMore' | 'loadMoreRecent'> & Pick<MessagesContextValue, 'disableTypingIndicator' | 'FlatList' | 'myMessageTheme' | 'shouldShowUnreadUnderlay'> & Pick<ThreadContextValue, 'loadMoreRecentThread' | 'loadMoreThread' | 'thread' | 'threadHasMore' | 'threadInstance'> & {
14
14
  /**
15
15
  * Besides existing (default) UX behavior of underlying FlatList of MessageList component, if you want
16
16
  * to attach some additional props to underlying FlatList, you can add it to following prop.
@@ -1 +1 @@
1
- {"version":3,"file":"MessageFlashList.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageList/MessageFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+E,MAAM,OAAO,CAAC;AACpG,OAAO,EAAqB,eAAe,EAAoC,MAAM,cAAc,CAAC;AAIpG,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAkB,YAAY,EAAmB,MAAM,aAAa,CAAC;AAUjF,OAAO,EACL,4BAA4B,EAE7B,MAAM,gEAAgE,CAAC;AACxE,OAAO,EACL,mBAAmB,EAEpB,MAAM,8CAA8C,CAAC;AAC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,GAAG,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACnF;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAomCJ,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAEpE,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,sBA2ElD,CAAC"}
1
+ {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageList/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,YAAY,EAExB,eAAe,EAIhB,MAAM,cAAc,CAAC;AAgBtB,OAAO,EAEL,6BAA6B,EAC9B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,gEAAgE,CAAC;AACxE,OAAO,EACL,mBAAmB,EAEpB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAkB,MAAM,wCAAwC,CAAC;AAI1F,OAAO,EACL,wBAAwB,EAEzB,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EACL,oBAAoB,EAErB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,2BAA2B,EAE5B,MAAM,8DAA8D,CAAC;AACtE,OAAO,EACL,gCAAgC,EAEjC,MAAM,wEAAwE,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAoB,MAAM,4CAA4C,CAAC;AA2IlG,KAAK,2BAA2B,GAAG,IAAI,CACrC,4BAA4B,EAC5B,aAAa,GAAG,uBAAuB,CACxC,GACC,IAAI,CAAC,2BAA2B,EAAE,YAAY,CAAC,GAC/C,IAAI,CACF,mBAAmB,EACjB,SAAS,GACT,yBAAyB,GACzB,UAAU,GACV,sBAAsB,GACtB,0BAA0B,GAC1B,SAAS,G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gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAEpE,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,sBA2ElD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { MessageResponse } from 'stream-chat';
2
- export declare const getChannelMessages: ({ channelIds, currentUserId, }: {
2
+ export declare const getChannelMessages: ({ channelIds, currentUserId, messageLimit, }: {
3
3
  channelIds: string[];
4
4
  currentUserId: string;
5
+ messageLimit?: number;
5
6
  }) => Promise<Record<string, MessageResponse[]>>;
6
7
  //# sourceMappingURL=getChannelMessages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getChannelMessages.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/getChannelMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAWnD,eAAO,MAAM,kBAAkB,GAAU,gCAGtC;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB,+CA8EA,CAAC"}
1
+ {"version":3,"file":"getChannelMessages.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/getChannelMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAWnD,eAAO,MAAM,kBAAkB,GAAU,8CAItC;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,+CA+EA,CAAC"}
@@ -5,11 +5,13 @@ import type { ChannelAPIResponse } from 'stream-chat';
5
5
  * @param {Object} param
6
6
  * @param {Array} param.channelIds List of channel ids to fetch.
7
7
  * @param {Array} param.currentUserId Id of the current logged in user.
8
+ * @param {number} param.messageLimit How many of each channel's newest messages to return, 25 by default.
8
9
  *
9
10
  * @returns {Array} Channels with enriched state.
10
11
  */
11
- export declare const getChannels: ({ channelIds, currentUserId, }: {
12
+ export declare const getChannels: ({ channelIds, currentUserId, messageLimit, }: {
12
13
  channelIds: string[];
13
14
  currentUserId: string;
15
+ messageLimit?: number;
14
16
  }) => Promise<Omit<ChannelAPIResponse, "duration">[]>;
15
17
  //# sourceMappingURL=getChannels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getChannels.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/getChannels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAYtD;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAU,gCAG/B;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAAE,CA2BjD,CAAC"}
1
+ {"version":3,"file":"getChannels.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/getChannels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAYtD;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GAAU,8CAI/B;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAAE,CA4BjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getChannelsForFilterSort.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/getChannelsForFilterSort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAOnG;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAU,4CAK5C;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,KAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAAE,GAAG,IAAI,CAwBxD,CAAC"}
1
+ {"version":3,"file":"getChannelsForFilterSort.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/getChannelsForFilterSort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAOnG;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAU,4CAK5C;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,KAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAAE,GAAG,IAAI,CAyBxD,CAAC"}
@@ -1,3 +1,5 @@
1
1
  import type { TableRowJoinedUser } from '../../types';
2
- export declare const selectMessagesForChannels: (cids: string[]) => Promise<TableRowJoinedUser<"messages">[]>;
2
+ /** The `message_limit` the client assumes for a channel list query that sets none. */
3
+ export declare const DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT = 25;
4
+ export declare const selectMessagesForChannels: (cids: string[], messageLimit?: number) => Promise<TableRowJoinedUser<"messages">[]>;
3
5
  //# sourceMappingURL=selectMessagesForChannels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectMessagesForChannels.d.ts","sourceRoot":"","sources":["../../../../../src/store/apis/queries/selectMessagesForChannels.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAM,yBAAyB,GACpC,MAAM,MAAM,EAAE,KACb,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAwC1C,CAAC"}
1
+ {"version":3,"file":"selectMessagesForChannels.d.ts","sourceRoot":"","sources":["../../../../../src/store/apis/queries/selectMessagesForChannels.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,sFAAsF;AACtF,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD,eAAO,MAAM,yBAAyB,GACpC,MAAM,MAAM,EAAE,EACd,eAAc,MAA2C,KACxD,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAyC1C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "9.11.0",
4
+ "version": "9.11.1-beta.1",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -4,6 +4,7 @@ import { LayoutChangeEvent, ScrollViewProps, StyleSheet, View, useColorScheme }
4
4
  import Animated from 'react-native-reanimated';
5
5
 
6
6
  import type { FlashListProps, FlashListRef } from '@shopify/flash-list';
7
+ import debounce from 'lodash/debounce';
7
8
  import type { Channel, Event, LocalMessage, MessageResponse } from 'stream-chat';
8
9
 
9
10
  import { useMessageList } from './hooks/useMessageList';
@@ -147,7 +148,7 @@ type MessageFlashListPropsWithContext = Pick<
147
148
  > &
148
149
  Pick<
149
150
  ThreadContextValue,
150
- 'loadMoreRecentThread' | 'loadMoreThread' | 'thread' | 'threadInstance'
151
+ 'loadMoreRecentThread' | 'loadMoreThread' | 'thread' | 'threadHasMore' | 'threadInstance'
151
152
  > & {
152
153
  /**
153
154
  * Besides existing (default) UX behavior of underlying FlatList of MessageList component, if you want
@@ -346,6 +347,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
346
347
  hasPendingInitialTargetLoad,
347
348
  targetedMessage,
348
349
  thread,
350
+ threadHasMore,
349
351
  threadInstance,
350
352
  threadList = false,
351
353
  } = props;
@@ -835,6 +837,16 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
835
837
  * once per content length.
836
838
  */
837
839
 
840
+ /**
841
+ * How many messages the list pages through are loaded: the thread's replies in a thread list, the
842
+ * channel's messages otherwise.
843
+ */
844
+ const getLoadedMessageCount = useStableCallback(() =>
845
+ threadList && thread?.id
846
+ ? (channel?.state.threads[thread.id]?.length ?? 0)
847
+ : (channel?.state.messages.length ?? 0),
848
+ );
849
+
838
850
  /**
839
851
  * 1. Makes a call to `loadMore` function, which queries more older messages.
840
852
  * 2. Ensures that we call `loadMore`, once per content length
@@ -853,8 +865,11 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
853
865
  onStartReachedTracker.current[processedMessageList.length] = true;
854
866
  }
855
867
 
856
- const callback = () => {
868
+ const callback = (loadedMessageCount: number) => {
857
869
  onStartReachedInPromise.current = null;
870
+ if (getLoadedMessageCount() === loadedMessageCount) {
871
+ onError();
872
+ }
858
873
  return Promise.resolve();
859
874
  };
860
875
 
@@ -869,12 +884,13 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
869
884
  if (onEndReachedInPromise.current) {
870
885
  await onEndReachedInPromise.current;
871
886
  }
887
+ const loadedMessageCount = getLoadedMessageCount();
872
888
  onStartReachedInPromise.current = (
873
889
  threadList && !!threadInstance && loadMoreRecentThread
874
890
  ? loadMoreRecentThread({})
875
891
  : loadMoreRecent()
876
892
  )
877
- .then(callback)
893
+ .then(() => callback(loadedMessageCount))
878
894
  .catch(onError);
879
895
  });
880
896
 
@@ -885,7 +901,10 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
885
901
  */
886
902
  const maybeCallOnEndReached = useStableCallback(async () => {
887
903
  // If onStartReached has already been called for given data length, then ignore.
888
- if (processedMessageList?.length && onEndReachedTracker.current[processedMessageList.length]) {
904
+ if (
905
+ (processedMessageList?.length && onEndReachedTracker.current[processedMessageList.length]) ||
906
+ (threadList && !threadHasMore)
907
+ ) {
889
908
  return;
890
909
  }
891
910
 
@@ -893,9 +912,11 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
893
912
  onEndReachedTracker.current[processedMessageList.length] = true;
894
913
  }
895
914
 
896
- const callback = () => {
915
+ const callback = (loadedMessageCount: number) => {
897
916
  onEndReachedInPromise.current = null;
898
-
917
+ if (getLoadedMessageCount() === loadedMessageCount) {
918
+ onError();
919
+ }
899
920
  return Promise.resolve();
900
921
  };
901
922
 
@@ -911,8 +932,9 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
911
932
  await onStartReachedInPromise.current;
912
933
  }
913
934
 
935
+ const loadedMessageCount = getLoadedMessageCount();
914
936
  onEndReachedInPromise.current = (threadList ? loadMoreThread() : loadMore())
915
- .then(callback)
937
+ .then(() => callback(loadedMessageCount))
916
938
  .catch(onError);
917
939
  });
918
940
 
@@ -1100,6 +1122,31 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
1100
1122
  currentListHeightRef.current = height;
1101
1123
  });
1102
1124
 
1125
+ const debouncedPrefillMessages = useMemo(
1126
+ () =>
1127
+ debounce(
1128
+ (viewportHeight: number, contentHeight: number) => {
1129
+ if (viewportHeight >= contentHeight) {
1130
+ maybeCallOnEndReached();
1131
+ }
1132
+ },
1133
+ 500,
1134
+ {
1135
+ leading: false,
1136
+ trailing: true,
1137
+ },
1138
+ ),
1139
+ [maybeCallOnEndReached],
1140
+ );
1141
+
1142
+ const onContentSizeChange = useStableCallback((width: number, height: number) => {
1143
+ if (additionalFlashListProps?.onContentSizeChange) {
1144
+ additionalFlashListProps.onContentSizeChange(width, height);
1145
+ }
1146
+
1147
+ debouncedPrefillMessages(currentListHeightRef.current ?? 0, height);
1148
+ });
1149
+
1103
1150
  const ListFooterComponent = useCallback(() => {
1104
1151
  if (FooterComponent) {
1105
1152
  return <FooterComponent />;
@@ -1172,6 +1219,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
1172
1219
  {...additionalFlashListPropsExcludingStyle}
1173
1220
  accessibilityActions={messageListAccessibilityActions}
1174
1221
  onAccessibilityAction={messageListOnAccessibilityAction}
1222
+ onContentSizeChange={onContentSizeChange}
1175
1223
  />
1176
1224
  </MessageListItemProvider>
1177
1225
  )}
@@ -1313,7 +1361,8 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
1313
1361
  const { disableTypingIndicator, FlatList, myMessageTheme, shouldShowUnreadUnderlay } =
1314
1362
  useMessagesContext();
1315
1363
  const { loadMore, loadMoreRecent } = usePaginatedMessageListContext();
1316
- const { loadMoreRecentThread, loadMoreThread, thread, threadInstance } = useThreadContext();
1364
+ const { loadMoreRecentThread, loadMoreThread, thread, threadHasMore, threadInstance } =
1365
+ useThreadContext();
1317
1366
  const { readEvents } = useOwnCapabilitiesContext();
1318
1367
  const { allowSendBeforeAttachmentsUpload, messageInputFloating, messageInputHeightStore } =
1319
1368
  useMessageInputContext();
@@ -1355,6 +1404,7 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
1355
1404
  shouldShowUnreadUnderlay,
1356
1405
  targetedMessage,
1357
1406
  thread,
1407
+ threadHasMore,
1358
1408
  threadInstance,
1359
1409
  threadList,
1360
1410
  }}
@@ -932,6 +932,16 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
932
932
  * once per content length.
933
933
  */
934
934
 
935
+ /**
936
+ * How many messages the list pages through are loaded: the thread's replies in a thread list, the
937
+ * channel's messages otherwise.
938
+ */
939
+ const getLoadedMessageCount = useStableCallback(() =>
940
+ threadList && thread?.id
941
+ ? (channel?.state.threads[thread.id]?.length ?? 0)
942
+ : (channel?.state.messages.length ?? 0),
943
+ );
944
+
935
945
  /**
936
946
  * 1. Makes a call to `loadMoreRecent` function, which queries more recent messages.
937
947
  * 2. Ensures that we call `loadMoreRecent`, once per content length
@@ -950,9 +960,11 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
950
960
  onStartReachedTracker.current[processedMessageList.length] = true;
951
961
  }
952
962
 
953
- const callback = () => {
963
+ const callback = (loadedMessageCount: number) => {
954
964
  onStartReachedInPromise.current = null;
955
-
965
+ if (getLoadedMessageCount() === loadedMessageCount) {
966
+ onError();
967
+ }
956
968
  return Promise.resolve();
957
969
  };
958
970
 
@@ -967,12 +979,13 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
967
979
  if (onEndReachedInPromise.current) {
968
980
  await onEndReachedInPromise.current;
969
981
  }
982
+ const loadedMessageCount = getLoadedMessageCount();
970
983
  onStartReachedInPromise.current = (
971
984
  threadList && !!threadInstance && loadMoreRecentThread
972
985
  ? loadMoreRecentThread({})
973
986
  : loadMoreRecent()
974
987
  )
975
- .then(callback)
988
+ .then(() => callback(loadedMessageCount))
976
989
  .catch(onError);
977
990
  });
978
991
 
@@ -995,8 +1008,11 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
995
1008
  onEndReachedTracker.current[processedMessageList.length] = true;
996
1009
  }
997
1010
 
998
- const callback = () => {
1011
+ const callback = (loadedMessageCount: number) => {
999
1012
  onEndReachedInPromise.current = null;
1013
+ if (getLoadedMessageCount() === loadedMessageCount) {
1014
+ onError();
1015
+ }
1000
1016
  return Promise.resolve();
1001
1017
  };
1002
1018
 
@@ -1011,8 +1027,9 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
1011
1027
  if (onStartReachedInPromise.current) {
1012
1028
  await onStartReachedInPromise.current;
1013
1029
  }
1030
+ const loadedMessageCount = getLoadedMessageCount();
1014
1031
  onEndReachedInPromise.current = (threadList ? loadMoreThread() : loadMore())
1015
- .then(callback)
1032
+ .then(() => callback(loadedMessageCount))
1016
1033
  .catch(onError);
1017
1034
  });
1018
1035
 
@@ -650,6 +650,57 @@ describe('MessageList pagination', () => {
650
650
  });
651
651
  });
652
652
 
653
+ it('tries loading older messages again after a load that loaded nothing', async () => {
654
+ const user1 = generateUser();
655
+ const mockedChannel = generateChannelResponse({
656
+ members: [generateMember({ user: user1 })],
657
+ messages: Array.from({ length: 100 }, (_, i) => generateMessage({ text: `message-${i}` })),
658
+ });
659
+
660
+ const chatClient = await getTestClientWithUser({ id: 'testID' });
661
+ useMockedApis(chatClient, [getOrCreateChannelApi(mockedChannel)]);
662
+ const channel = chatClient.channel('messaging', mockedChannel.channel.id);
663
+ await channel.watch();
664
+
665
+ // resolves without loading anything, as `loadMore` does when its request fails, e.g. offline
666
+ const loadMore = jest.fn(() => Promise.resolve());
667
+ mockedHook({ loadMore });
668
+
669
+ const { getByTestId } = render(
670
+ <OverlayProvider>
671
+ <Chat client={chatClient}>
672
+ <Channel channel={channel}>
673
+ <MessageList />
674
+ </Channel>
675
+ </Chat>
676
+ </OverlayProvider>,
677
+ );
678
+
679
+ const scrollToEnd = () =>
680
+ act(() => {
681
+ fireEvent(getByTestId('message-flat-list'), 'momentumScrollEnd', {
682
+ nativeEvent: {
683
+ contentOffset: { y: 1900 },
684
+ contentSize: { height: 2000, width: 200 },
685
+ layoutMeasurement: { height: 400, width: 200 },
686
+ },
687
+ });
688
+ });
689
+
690
+ scrollToEnd();
691
+ await waitFor(() => {
692
+ expect(loadMore).toHaveBeenCalledTimes(1);
693
+ });
694
+
695
+ // released after the same 2 second backoff as a rejected load
696
+ await act(() => new Promise((resolve) => setTimeout(resolve, 2100)));
697
+ scrollToEnd();
698
+
699
+ await waitFor(() => {
700
+ expect(loadMore).toHaveBeenCalledTimes(2);
701
+ });
702
+ });
703
+
653
704
  it('should call load latest messages when the scroll to bottom button is pressed', async () => {
654
705
  const user1 = generateUser();
655
706
  const messages = Array.from({ length: 10 }, (_, i) =>
@@ -0,0 +1,63 @@
1
+ import type { ChannelAPIResponse } from 'stream-chat';
2
+
3
+ import { generateChannelResponse } from '../../mock-builders/generator/channel';
4
+ import { generateMessage } from '../../mock-builders/generator/message';
5
+ import { BetterSqlite } from '../../test-utils/BetterSqlite';
6
+ import { getChannels } from '../apis/getChannels';
7
+ import { selectMessagesForChannels } from '../apis/queries/selectMessagesForChannels';
8
+ import { upsertChannels } from '../apis/upsertChannels';
9
+ import { SqliteClient } from '../SqliteClient';
10
+
11
+ /**
12
+ * The client reads the cached page as a channel list page of `message_limit` messages, so a page of
13
+ * a different size makes it guess wrongly whether older messages exist, for example that a channel
14
+ * with a long history starts at its cached messages.
15
+ */
16
+ describe('selectMessagesForChannels', () => {
17
+ let cid: string;
18
+ let messages: ReturnType<typeof generateMessage>[];
19
+
20
+ beforeEach(async () => {
21
+ await SqliteClient.initializeDatabase();
22
+ await BetterSqlite.openDB();
23
+
24
+ const channelResponse = generateChannelResponse({ members: [], messages: [] });
25
+ cid = channelResponse.channel.cid as string;
26
+ messages = Array.from({ length: 30 }, (_, i) =>
27
+ generateMessage({ cid, timestamp: new Date(Date.UTC(2020, 0, 1, 0, i)) }),
28
+ );
29
+ channelResponse.messages = messages as unknown as typeof channelResponse.messages;
30
+ await upsertChannels({
31
+ channels: [channelResponse] as unknown as ChannelAPIResponse[],
32
+ isLatestMessagesSet: true,
33
+ });
34
+ });
35
+
36
+ afterEach(() => {
37
+ BetterSqlite.dropAllTables();
38
+ BetterSqlite.closeDB();
39
+ });
40
+
41
+ const ids = (rows: { id: string }[]) => rows.map((row) => row.id);
42
+
43
+ it("returns a channel's newest 25 messages, oldest first, by default", async () => {
44
+ const rows = await selectMessagesForChannels([cid]);
45
+
46
+ expect(ids(rows)).toEqual(ids(messages.slice(-25)));
47
+ });
48
+
49
+ it("returns a channel's newest `messageLimit` messages", async () => {
50
+ expect(ids(await selectMessagesForChannels([cid], 10))).toEqual(ids(messages.slice(-10)));
51
+ expect(ids(await selectMessagesForChannels([cid], 50))).toEqual(ids(messages));
52
+ });
53
+
54
+ it('applies the limit that getChannels is given', async () => {
55
+ const [channel] = await getChannels({
56
+ channelIds: [cid],
57
+ currentUserId: 'some-user',
58
+ messageLimit: 10,
59
+ });
60
+
61
+ expect(ids(channel.messages)).toEqual(ids(messages.slice(-10)));
62
+ });
63
+ });
@@ -12,15 +12,18 @@ import type { TableRow, TableRowJoinedUser } from '../types';
12
12
  export const getChannelMessages = async ({
13
13
  channelIds,
14
14
  currentUserId,
15
+ messageLimit,
15
16
  }: {
16
17
  channelIds: string[];
17
18
  currentUserId: string;
19
+ messageLimit?: number;
18
20
  }) => {
19
21
  SqliteClient.logger?.('info', 'getChannelMessages', {
20
22
  channelIds,
21
23
  currentUserId,
24
+ messageLimit,
22
25
  });
23
- const messageRows = await selectMessagesForChannels(channelIds);
26
+ const messageRows = await selectMessagesForChannels(channelIds, messageLimit);
24
27
  const messageIds = messageRows.map(({ id }) => id);
25
28
 
26
29
  // Populate the message reactions.
@@ -16,17 +16,20 @@ import { SqliteClient } from '../SqliteClient';
16
16
  * @param {Object} param
17
17
  * @param {Array} param.channelIds List of channel ids to fetch.
18
18
  * @param {Array} param.currentUserId Id of the current logged in user.
19
+ * @param {number} param.messageLimit How many of each channel's newest messages to return, 25 by default.
19
20
  *
20
21
  * @returns {Array} Channels with enriched state.
21
22
  */
22
23
  export const getChannels = async ({
23
24
  channelIds,
24
25
  currentUserId,
26
+ messageLimit,
25
27
  }: {
26
28
  channelIds: string[];
27
29
  currentUserId: string;
30
+ messageLimit?: number;
28
31
  }): Promise<Omit<ChannelAPIResponse, 'duration'>[]> => {
29
- SqliteClient.logger?.('info', 'getChannels', { channelIds, currentUserId });
32
+ SqliteClient.logger?.('info', 'getChannels', { channelIds, currentUserId, messageLimit });
30
33
 
31
34
  const [channels, cidVsDraft, cidVsMembers, cidVsReads, cidVsMessages, cidVsActiveLocations] =
32
35
  await Promise.all([
@@ -37,6 +40,7 @@ export const getChannels = async ({
37
40
  getChannelMessages({
38
41
  channelIds,
39
42
  currentUserId,
43
+ messageLimit,
40
44
  }),
41
45
  getChannelActiveLocations({ channelIds }),
42
46
  ]);
@@ -48,5 +48,6 @@ export const getChannelsForFilterSort = async ({
48
48
  return await getChannels({
49
49
  channelIds,
50
50
  currentUserId,
51
+ messageLimit: options?.message_limit,
51
52
  });
52
53
  };