@azure/communication-react 1.11.1-alpha-202312220012 → 1.11.1-alpha-202312230012

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.
@@ -170,7 +170,7 @@ function getDefaultExportFromCjs (x) {
170
170
  // Copyright (c) Microsoft Corporation.
171
171
  // Licensed under the MIT License.
172
172
  // GENERATED FILE. DO NOT EDIT MANUALLY.
173
- var telemetryVersion = '1.11.1-alpha-202312220012';
173
+ var telemetryVersion = '1.11.1-alpha-202312230012';
174
174
 
175
175
 
176
176
  var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
@@ -6025,7 +6025,6 @@ const wrapper = react.mergeStyles({
6025
6025
  const defaultTheme = Object.assign({}, react.mergeThemes(react.getTheme(), lightTheme));
6026
6026
  /** Theme context for library's react components */
6027
6027
  const ThemeContext = React.createContext(defaultTheme);
6028
- const SingleUsageCheckContext = React.createContext(false);
6029
6028
  /**
6030
6029
  * Provider to apply a Fluent theme across this library's react components.
6031
6030
  *
@@ -6036,21 +6035,10 @@ const SingleUsageCheckContext = React.createContext(false);
6036
6035
  */
6037
6036
  const FluentThemeProvider = (props) => {
6038
6037
  const { fluentTheme, rtl, children } = props;
6039
- /**
6040
- * Pass only the children if we previously wrapped.
6041
- * This is to prevent the provider from being applied
6042
- * multiple times and wiping out configuration like RTL
6043
- * FluentThemeProvider
6044
- */
6045
- const alreadyWrapped = useSingleUsageCheck();
6046
- if (alreadyWrapped) {
6047
- return React.createElement(React.Fragment, null, children);
6048
- }
6049
6038
  let fluentV8Theme = react.mergeThemes(defaultTheme, fluentTheme);
6050
6039
  fluentV8Theme = react.mergeThemes(fluentV8Theme, { rtl });
6051
- return (React.createElement(SingleUsageCheckContext.Provider, { value: true },
6052
- React.createElement(ThemeContext.Provider, { value: fluentV8Theme },
6053
- React.createElement(react.ThemeProvider, { theme: fluentV8Theme, className: wrapper }, children))));
6040
+ return (React.createElement(ThemeContext.Provider, { value: fluentV8Theme },
6041
+ React.createElement(react.ThemeProvider, { theme: fluentV8Theme, className: wrapper }, children)));
6054
6042
  };
6055
6043
  /**
6056
6044
  * React hook to access theme
@@ -6058,12 +6046,6 @@ const FluentThemeProvider = (props) => {
6058
6046
  * @public
6059
6047
  */
6060
6048
  const useTheme = () => React.useContext(ThemeContext);
6061
- /**
6062
- * This is used to prevent the provider from being applied multiple times.
6063
- *
6064
- * @private
6065
- */
6066
- const useSingleUsageCheck = () => React.useContext(SingleUsageCheckContext);
6067
6049
 
6068
6050
  // Copyright (c) Microsoft Corporation.
6069
6051
  // Licensed under the MIT License.
@@ -11209,6 +11191,9 @@ const MessageThreadWrapper = (props) => {
11209
11191
  }), [onFetchAttachments]);
11210
11192
  const localeStrings = useLocale$1().strings.messageThread;
11211
11193
  const strings = React.useMemo(() => (Object.assign(Object.assign({}, localeStrings), props.strings)), [localeStrings, props.strings]);
11194
+ // it is required to use useState for messages
11195
+ // as the scrolling logic requires re - render at a specific point in time
11196
+ const [messages, setMessages] = React.useState([]);
11212
11197
  // id for the latest deleted message
11213
11198
  const [latestDeletedMessageId, setLatestDeletedMessageId] = React.useState(undefined);
11214
11199
  // this value is used to check if a message is deleted for the previous value of messages array
@@ -11220,10 +11205,12 @@ const MessageThreadWrapper = (props) => {
11220
11205
  return;
11221
11206
  }
11222
11207
  try {
11223
- yield onDeleteMessage(messageId);
11224
11208
  // reset deleted message label in case if there was a value already (messages are deleted 1 after another)
11225
11209
  setDeletedMessageAriaLabel(undefined);
11226
11210
  setLatestDeletedMessageId(messageId);
11211
+ // we should set up latestDeletedMessageId before the onDeleteMessage call
11212
+ // as otherwise in very rare cases the messages array can be updated before latestDeletedMessageId
11213
+ yield onDeleteMessage(messageId);
11227
11214
  }
11228
11215
  catch (e) {
11229
11216
  console.log('onDeleteMessage failed: messageId', messageId, 'error', e);
@@ -11237,17 +11224,11 @@ const MessageThreadWrapper = (props) => {
11237
11224
  isAllChatMessagesLoadedRef.current = false;
11238
11225
  }
11239
11226
  }, [onLoadPreviousChatMessages]);
11240
- React.useEffect(() => {
11241
- reactFileTypeIcons.initializeFileTypeIcons();
11242
- }, []);
11243
11227
  const previousTopRef = React.useRef(-1);
11244
11228
  const previousHeightRef = React.useRef(-1);
11245
11229
  const messageIdSeenByMeRef = React.useRef('');
11246
11230
  const chatScrollDivRef = React.useRef(null);
11247
11231
  const isLoadingChatMessagesRef = React.useRef(false);
11248
- const messages = React.useMemo(() => {
11249
- return newMessages;
11250
- }, [newMessages]);
11251
11232
  React.useEffect(() => {
11252
11233
  if (latestDeletedMessageId === undefined) {
11253
11234
  setDeletedMessageAriaLabel(undefined);
@@ -11274,6 +11255,7 @@ const MessageThreadWrapper = (props) => {
11274
11255
  const messagesRef = React.useRef(messages);
11275
11256
  const setMessagesRef = (messagesWithAttachedValue) => {
11276
11257
  messagesRef.current = messagesWithAttachedValue;
11258
+ setMessages(messagesWithAttachedValue);
11277
11259
  };
11278
11260
  const isAtBottomOfScrollRef = React.useRef(isAtBottomOfScroll);
11279
11261
  const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue) => {