- React (app Router) < /li>
Webpack 5 + Federation < /li>
Дизайн муравья (компонент ящика) < /li>
ag grid (сообщество) < /li>
remote Компоненты загружаются с помощью динамического (() => < /li>
Remote Component Import ("remoteApp /component")) < /code> < /li>
< /ul>
Сводка настройки: < /h3>
rourt 1: /all-resources < /code> (работает нормально) < /h4>
Открывает ящик: Ag Grid рендеры. /> < /ul>Код: Выделить всё
Host App (/all-resources) └── Remote App A (component inside uses AG Grid) └── Remote App B └── Ant Design Drawer └── Remote App C (component inside uses AG Grid) < /code> Открывает ящик: рендеры Grid с правильными стилями. < /li> Ящик закрывает и повторно открывает: Ag Styles styles.Host App (/sms) └── Remote App A (component inside uses AG Grid) └── Ant Design Drawer └── Remote App C (component inside uses AG Grid)
Что я наблюдал: < /h3>
Grid Динамически вводит стили в < /code>Когда экземпляр последнего сетки Ag incondated , ag grid удаляет все его стили из Dom.Код: Выделить всё
...
Это проблематично, когда:
Компонент живет внутри заглуша Сетка является единственным экземпляром Ag Grid во всем приложении в этот момент. В некоторых маршрутах, но убрать в других? if:
The component using the grid unmounts - The grid comes from a Module Federation remote
- The parent (e.g., AntD Drawer) controls mount/unmount lifecycle
destroyOnClose={false} on Drawer: Prevents unmounting, keeps styles, but wastes memory
Using singleton: true in Module Federation shared config for AG Grid packages, /sms page doesn't even load ag-grid css at all
Keeping a hidden grid offscreen just to retain styles (feels very hacky)
Re-adding styles manually after unmount (difficult to sync with AG Grid’s internal logic)
ag grid использует некоторую внутреннюю подсчет справочника в стиле или управление синглтоном. Singleton < /code> строго соблюдается. < /p>
Способ к: < /p>
Границы < /li>
< /ul>
может кто -нибудь мне помочь ... < /p>
Подробнее здесь: https://stackoverflow.com/questions/796 ... eration-re