Skip to content

Dynamically updating className removes the internal hydrated class, making iX components invisible #2668

Open

Description

@soutriiv

Prerequisites

  • I have read the Contributing Guidelines.
  • I have not leaked any internal/restricted information like screenshots, videos, code snippets, links etc.

What happened?

Summary

After a component hydrates, Stencil adds an internal hydrated class to the host element, and by default all components without the hydrated class are styled with visibility: hidden (FOUC prevention injected by defineCustomElements()).

When React dynamically updates the className prop after the component has mounted, React replaces the host element's class attribute entirely. This removes the internal hydrated class, so the component becomes permanently invisible.

Conditions

This occurs when all of the following are true:

  • iX Web Components and React are used together in the same app
  • defineCustomElements() is called to register the web components
  • The iX React component is lazy loaded (e.g. via React.lazy)
  • className is set/updated dynamically after the iX component is mounted

The issue does not occur when the component is imported normally (not lazy loaded), or when className is static.

Reproduction

StackBlitz: https://stackblitz.com/edit/dm1yk8jy?file=src%2FIssue.tsx

  1. In a React app, call defineCustomElements() to register iX Web Components.
  2. Lazy load an iX React component.
  3. After the component has mounted (and Stencil has added the hydrated class), update its className prop dynamically, e.g. from state:
    const IxButton = React.lazy(() => import('...'));
    
    function ButtonWithIcon() {
      const [active, setActive] = useState(false);
      return (
        <IxButton
          className={active ? 'active-class' : 'inactive-class'}
          onClick={() => setActive((a) => !a)}
        />
      );
    }
  4. Inspect the host element's class attribute after the state change.
  5. Observe that the hydrated class is gone and the component is hidden by the default visibility: hidden rule.

Expected behavior

Updating className should merge with the host element's existing classes so the internal hydrated class is preserved and the component stays visible.

Actual behavior

The dynamic className update fully replaces the class attribute, removing the internal hydrated class. The component then matches the default :not(.hydrated) { visibility: hidden } rule and becomes invisible.

Reference

  1. Template renderers remove hydrated class stenciljs/core#2109 (comment)
  2. https://stenciljs.com/docs/config#hydratedflag

What type of frontend framework are you seeing the problem on?

Others, React, JavaScript

On which version of the frontend framework are you experiencing the issue?

react@^18.3.1

Which version of iX do you use?

v5.1.1

Code to produce this issue.

https://stackblitz.com/edit/dm1yk8jy?file=src%2FIssue.tsx

Activity

  1. added
    triageWe discuss this topic in our internal weekly
    on Jul 23, 2026
  2. added
    BacklogIts part of the team backlog
    and removed
    triageWe discuss this topic in our internal weekly
    on Jul 23, 2026
  3. AndreasBerliner commented on Jul 23, 2026

    @AndreasBerliner
    Collaborator

    Reference: EIX-106

  4. added this to the 6.0.0 milestone on Aug 6, 2026
  5. benjgil commented on Aug 6, 2026

    @benjgil
    Collaborator

    @soutriiv
    Fix implemented, as it's a breaking change will be released in version 6.0

  6. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

  7. removed this from the 6.0.0 milestone on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BacklogIts part of the team backlog

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions