Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IX Select input clears if selection options change (since version 2.6.1) #1716

Open
2 tasks done
vormacher opened this issue Feb 27, 2025 · 0 comments
Open
2 tasks done
Labels
triage We discuss this topic in our internal weekly

Comments

@vormacher
Copy link

Prerequisites

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

What happened?

Hi,

Use Case:
We're using the iX-select to search and select data in a database.
Every time the iX-select input changes, an API is being called to retrieve new data.

Problem:
Since the Version 2.6.1 the input is getting cleared if a new value (select-option) is being added.

In the "How to Produce", you will also find our current workaround by adding an additional div-container around the selects.

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

React

Which version of iX do you use?

2.6.1

Code to produce this issue.

// stackblitz: https://stackblitz.com/edit/react-ts-qcylb8l8?file=App.tsx
import * as React from 'react';
import './style.css';
import { IxSelect, IxSelectItem } from '@siemens/ix-react';

export default function App() {
  const [items, setItems] = React.useState<string[]>([]);

  const callApiWhichAddNewSelectOptions = (event: any) => {
    setTimeout(() => {
      setItems((prevItems) => [...prevItems, event.detail]);
    }, 1000);
  };

  return (
    <>
      <h3>broken select:</h3>
      <IxSelect
        value="1"
        onInputChange={callApiWhichAddNewSelectOptions}
        i18nPlaceholder="Search in database..."
      >
        {items.map((i, index) => (
          <IxSelectItem key={index} label={i} value={i}></IxSelectItem>
        ))}
      </IxSelect>
      <br />
      <br />
      <h3>working select (with additional container):</h3>
      <IxSelect
        value="1"
        onInputChange={callApiWhichAddNewSelectOptions}
        i18nPlaceholder="Search in database..."
      >
        <div>
          {items.map((i, index) => (
            <IxSelectItem key={index} label={i} value={i}></IxSelectItem>
          ))}
        </div>
      </IxSelect>
    </>
  );
}
@vormacher vormacher added the triage We discuss this topic in our internal weekly label Feb 27, 2025
@vormacher vormacher changed the title IX Select clears input if available selection options change (since version 2.6.1) IX Select input clears if selection options change (since version 2.6.1) Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage We discuss this topic in our internal weekly
Projects
None yet
Development

No branches or pull requests

1 participant