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[2.0.4] in React production build showToast error. #1006

Closed
mhmmdkndr opened this issue Dec 15, 2023 · 9 comments · Fixed by #1201
Closed

iX[2.0.4] in React production build showToast error. #1006

mhmmdkndr opened this issue Dec 15, 2023 · 9 comments · Fixed by #1201
Labels
type: bug Something isn't working

Comments

@mhmmdkndr
Copy link

What happened?

Hello iX Team,

We are using iX[2.0.4] in React. We encounter an error in the Toast component as in the picture below. All of the packages we build with "npm run build" have a similar situation, including the code on the ix webpage (https://ix.siemens.io/docs/controls/toast).
Someone can suggest any solution? Thanks in advance.
image

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

React

Which version of iX do you use?

2.0.4

Code to produce this issue.

https://stackblitz.com/run?file=src%2Ftoast.tsx
@mhmmdkndr mhmmdkndr added the triage We discuss this topic in our internal weekly label Dec 15, 2023
@jul-lam jul-lam self-assigned this Dec 21, 2023
@jul-lam jul-lam added wait for response Wait for author response and removed triage We discuss this topic in our internal weekly labels Dec 21, 2023
@jul-lam
Copy link
Collaborator

jul-lam commented Dec 21, 2023

When I run npm run build inside the react example from the documentation in Stackblitz, no error is thrown. However, a warning is displayed, which is not a problem in this case. The issue might be with the setup of the project you used to build the code. Can you please provide more details about it?

@robert-wettstaedt
Copy link
Contributor

@jul-lam here is a working example. It's just a project generated by create-react-app with @siemens/ix-react@2.0.4. The app has been built and is served from the build folder. Check the browser console when you click the button.

@jul-lam jul-lam added type: bug Something isn't working and removed wait for response Wait for author response labels Jan 10, 2024
@jul-lam
Copy link
Collaborator

jul-lam commented Jan 10, 2024

Thank you for providing the example! We will investigate the issue.

@mohitmutha
Copy link

mohitmutha commented Jan 23, 2024

We are facing the same issue. We are using vite for creating the project.
image

image

@mohitmutha
Copy link

Found a workaround. Not sure if this is the intended way to use the component.

When I add a IxToastContainer element to somewhere in the skeleton of the application the toast starts working. My guess is that when the element is created dynamically the class behaviour is getting lost and hence the issue.

Strangely this happens only in the transpiled build after running yarn build. When running in dev mode it works fine.

Please add a fix or modify the documentation.

@robert-wettstaedt
Copy link
Contributor

@mohitmutha that seems to be right!

However, it is important to note, that you cannot wrap it around your application as in:

<IxToastContainer>
  <Application />
</IxToastContainer>

Instead it needs to be its own enclosed tag sitting next to your application:

<>
  <IxToastContainer />
  <Application />
</>

The reason is that the component does not render its children. For some reason the line to do that is commented out.

@danielleroux
Copy link
Collaborator

We will do some refactorings regarding appending dynamic component, this refactorings will solve the issue. It is planned for the next releases.

[IX-822]

@danielleroux danielleroux added the Workflow: Issue created JIRA issue is created and will be analyzed label Jan 23, 2024
@dogukan-duduoglu
Copy link

Anyone having problems with icons not showing after building with the workaround?

@robert-wettstaedt
Copy link
Contributor

Anyone having problems with icons not showing after building with the workaround?

@dogukan-duduoglu No I did not experience this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants