From b517f614b37623c8fb6d9829a57926968ce4d999 Mon Sep 17 00:00:00 2001 From: Hristo Terezov Date: Wed, 3 Dec 2025 22:03:35 -0600 Subject: [PATCH] fix(RN): Remove web files from build. filmstrip/actions.web was imported in TileView native component. filmstrip/actions.web was imported in config middleware.any. --- react/features/app/middlewares.any.ts | 1 - react/features/app/middlewares.native.ts | 1 + react/features/app/middlewares.web.ts | 1 + .../{middleware.ts => middleware.any.ts} | 22 --------- .../features/base/config/middleware.native.ts | 1 + react/features/base/config/middleware.web.ts | 45 +++++++++++++++++++ .../filmstrip/components/native/TileView.tsx | 2 +- 7 files changed, 49 insertions(+), 24 deletions(-) rename react/features/base/config/{middleware.ts => middleware.any.ts} (86%) create mode 100644 react/features/base/config/middleware.native.ts create mode 100644 react/features/base/config/middleware.web.ts diff --git a/react/features/app/middlewares.any.ts b/react/features/app/middlewares.any.ts index b7a70f5e80..38080ce335 100644 --- a/react/features/app/middlewares.any.ts +++ b/react/features/app/middlewares.any.ts @@ -2,7 +2,6 @@ import '../analytics/middleware'; import '../authentication/middleware'; import '../av-moderation/middleware'; import '../base/conference/middleware'; -import '../base/config/middleware'; import '../base/i18n/middleware'; import '../base/jwt/middleware'; import '../base/known-domains/middleware'; diff --git a/react/features/app/middlewares.native.ts b/react/features/app/middlewares.native.ts index 200df5931a..ceeaaf89d1 100644 --- a/react/features/app/middlewares.native.ts +++ b/react/features/app/middlewares.native.ts @@ -1,3 +1,4 @@ +import '../base/config/middleware'; import '../dynamic-branding/middleware'; import '../gifs/middleware'; import '../mobile/audio-mode/middleware'; diff --git a/react/features/app/middlewares.web.ts b/react/features/app/middlewares.web.ts index 7e47425fe4..11dc496100 100644 --- a/react/features/app/middlewares.web.ts +++ b/react/features/app/middlewares.web.ts @@ -1,4 +1,5 @@ import '../base/app/middleware'; +import '../base/config/middleware'; import '../base/connection/middleware'; import '../base/devices/middleware'; import '../base/media/middleware'; diff --git a/react/features/base/config/middleware.ts b/react/features/base/config/middleware.any.ts similarity index 86% rename from react/features/base/config/middleware.ts rename to react/features/base/config/middleware.any.ts index 3605486993..df7f900c84 100644 --- a/react/features/base/config/middleware.ts +++ b/react/features/base/config/middleware.any.ts @@ -2,7 +2,6 @@ import { AnyAction } from 'redux'; import { IStore } from '../../app/types'; import { SET_DYNAMIC_BRANDING_DATA } from '../../dynamic-branding/actionTypes'; -import { setUserFilmstripWidth } from '../../filmstrip/actions.web'; import { getFeatureFlag } from '../flags/functions'; import MiddlewareRegistry from '../redux/MiddlewareRegistry'; import { updateSettings } from '../settings/actions'; @@ -80,29 +79,8 @@ function _setConfig({ dispatch, getState }: IStore, next: Function, action: AnyA })); } - const { initialWidth, stageFilmstripParticipants } = action.config.filmstrip || {}; - - if (stageFilmstripParticipants !== undefined) { - dispatch(updateSettings({ - maxStageParticipants: stageFilmstripParticipants - })); - } - - if (initialWidth) { - dispatch(setUserFilmstripWidth(initialWidth)); - } - dispatch(updateConfig(config)); - // FIXME On Web we rely on the global 'config' variable which gets altered - // multiple times, before it makes it to the reducer. At some point it may - // not be the global variable which is being modified anymore due to - // different merge methods being used along the way. The global variable - // must be synchronized with the final state resolved by the reducer. - if (typeof window.config !== 'undefined') { - window.config = state['features/base/config']; - } - return result; } diff --git a/react/features/base/config/middleware.native.ts b/react/features/base/config/middleware.native.ts new file mode 100644 index 0000000000..fefd329e8a --- /dev/null +++ b/react/features/base/config/middleware.native.ts @@ -0,0 +1 @@ +import './middleware.any'; diff --git a/react/features/base/config/middleware.web.ts b/react/features/base/config/middleware.web.ts new file mode 100644 index 0000000000..0009f714fa --- /dev/null +++ b/react/features/base/config/middleware.web.ts @@ -0,0 +1,45 @@ +import { setUserFilmstripWidth } from '../../filmstrip/actions.web'; +import MiddlewareRegistry from '../redux/MiddlewareRegistry'; +import { updateSettings } from '../settings/actions'; + +import { SET_CONFIG } from './actionTypes'; +import './middleware.any'; + +/** + * The middleware of the feature {@code base/config}. + * + * @param {Store} store - The redux store. + * @private + * @returns {Function} + */ +MiddlewareRegistry.register(store => next => action => { + switch (action.type) { + case SET_CONFIG: { + const { initialWidth, stageFilmstripParticipants } = action.config.filmstrip || {}; + const { dispatch, getState } = store; + const result = next(action); + const state = getState(); + + if (stageFilmstripParticipants !== undefined) { + dispatch(updateSettings({ + maxStageParticipants: stageFilmstripParticipants + })); + } + + if (initialWidth) { + dispatch(setUserFilmstripWidth(initialWidth)); + } + + // FIXME On Web we rely on the global 'config' variable which gets altered + // multiple times, before it makes it to the reducer. At some point it may + // not be the global variable which is being modified anymore due to + // different merge methods being used along the way. The global variable + // must be synchronized with the final state resolved by the reducer. + if (typeof window.config !== 'undefined') { + window.config = state['features/base/config']; + } + + return result; + } + } +}); diff --git a/react/features/filmstrip/components/native/TileView.tsx b/react/features/filmstrip/components/native/TileView.tsx index cb200ae3eb..4d34e8d45a 100644 --- a/react/features/filmstrip/components/native/TileView.tsx +++ b/react/features/filmstrip/components/native/TileView.tsx @@ -12,7 +12,7 @@ import { IReduxState, IStore } from '../../../app/types'; import { getLocalParticipant, getParticipantCountWithFake } from '../../../base/participants/functions'; import { ILocalParticipant } from '../../../base/participants/types'; import { getHideSelfView } from '../../../base/settings/functions.any'; -import { setVisibleRemoteParticipants } from '../../actions.web'; +import { setVisibleRemoteParticipants } from '../../actions.native'; import Thumbnail from './Thumbnail'; import styles from './styles';