Skip to content

[SF][FlexBox]: Component style removed after another ui5-wc-react context is closed #5842

@ksblklu02

Description

@ksblklu02

Describe the bug

Hi Team,
We are upgrading ui5-wc-react version to 1.28.1. When the page have multiple app, each app has it own ui5-wc-react instance. If we close one app, the component in it will be unmounted, and the corresponding stylesheet will be removed. This will affects other apps on the page if they are using same component in the unmounted app.

This issue happened after this pr is released: #5611

And the root cause is a new hook is adopted to manage ui5-wc-react component styles, this hoot will remove the stylesheet in the document object, which will affect all others app using ui5-webomponent-react component styles.

at https://github.com/SAP/ui5-webcomponents-react/blob/1d3decd9e2156a6f016987ab8e946b14e9a27fd8/packages/main/src/components/FlexBox/index.tsx#L71

at
https://github.com/SAP/ui5-webcomponents-react/blob/1d3decd9e2156a6f016987ab8e946b14e9a27fd8/packages/base/src/hooks/useStylesheet.ts#L41

Isolated Example

No response

Reproduction steps

  1. Open a page that has two different app with different ui5-wc-react context, both have FlexBox component render inside.
  2. Unmount one of the app
  3. See the style of the FlexBox component in another app is also removed

Expected Behaviour

Stylesheet removal should not be affecting component in different ui5-wc-react context

Screenshots or Videos

No response

UI5 Web Components for React Version

1.28.1

UI5 Web Components Version

1.24.0

Browser

Chrome

Operating System

MacOS

Additional Context

No response

Relevant log output

No response

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions