Skip to content

bug: Stenciljs 4.23.1 regression - classes list on child elements of html "dialog" tag is not always updated in html on prop change #6115

@kievsash

Description

@kievsash

Prerequisites

Stencil Version

4.23.1

Current Behavior

Reproduced: "@stencil/core": "4.23.1",
Not reproduced: "@stencil/core": "4.23.0",

If I show list in <dialog> {this.someList}</dialog> and some classes should be recalculated if list item prop changes - it doesnot always happen.
Initially selected marked with red item stays marked with red if I select other item in list (prop "selected" changes to false but class is not unassigned).

Here is gif with reproduce steps:
Image

Expected Behavior

Items classes for list items inside element always be updated correctly.

System Info

npx stencil info

      System: node 18.20.5
    Platform: darwin (21.6.0)
   CPU Model: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz (8 cpus)
    Compiler: /.../regression-reproduce-repo/node_modules/@stencil/core/compiler/stencil.js
       Build: 1736187268
     Stencil: 4.23.1 🌯
  TypeScript: 5.5.4
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

Reproduce repo: https://github.com/kievsash/stencil-4-dialog-bug-reproduce

Just npm i, npm start and check list behaviour when you select another item - previously selected item stays with selected background.

Here is gif with reproduce steps:
Image

Code Reproduction URL

https://github.com/kievsash/stencil-4-dialog-bug-reproduce

Additional Information

Minimal code:

  render() {
    this.items.forEach((item: IItem) => {
      item.selected = this.selectedItems.includes(item.id);
    });

    const items: IItem[] = this.items.map((item: IItem) => (
      <app-dropdown-item
        label={item.label}
        selected={this.isSelected(item)}
        uid={item.id}
        onItemSelected={this.handleItemClick}
        key={String(item.id)}
      ></app-dropdown-item>
    ));

    return (
      <div class="dropdown" >
        <button onClick={() => this.toggleDropdown()}>
          Toggle Dropdown
        </button>
        <dialog open={this.isOpen}>
            <div class="dropdown-menu" slot="scroll-box" ref={(el) => (this.selectableListElement = el)}>
              {items}
            </div>
        </dialog>

      </div>
    );
  }

Whole reproduce repo: https://github.com/kievsash/stencil-4-dialog-bug-reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within StencilHelp Wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions