@myun/gimi-chat 0.7.9 → 0.8.0

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.
@@ -10,7 +10,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
- import React, { useCallback, useLayoutEffect, useMemo, useState } from 'react';
13
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
14
14
  import classNames from 'classnames';
15
15
  import styles from "./index.module.css";
16
16
  import { Spin } from '@douyinfe/semi-ui';
@@ -120,10 +120,11 @@ var MessageList = function MessageList(_ref) {
120
120
  _useState2 = _slicedToArray(_useState, 2),
121
121
  scrollParent = _useState2[0],
122
122
  setScrollParent = _useState2[1];
123
- useLayoutEffect(function () {
124
- var _containerRef$current;
125
- setScrollParent((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : null);
126
- }, [containerRef]);
123
+ useEffect(function () {
124
+ if (containerRef.current && containerRef.current !== scrollParent) {
125
+ setScrollParent(containerRef.current);
126
+ }
127
+ }, [containerRef, scrollParent, chatList]);
127
128
  var visibleChatList = useMemo(function () {
128
129
  return (chatList || []).filter(function (item) {
129
130
  if (!item) return false;