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

[Rating] [dispose() method throws an error] #2006

Closed
Nikitossik opened this issue Oct 16, 2023 · 1 comment · Fixed by #2088
Closed

[Rating] [dispose() method throws an error] #2006

Nikitossik opened this issue Oct 16, 2023 · 1 comment · Fixed by #2088
Assignees
Labels
Milestone

Comments

@Nikitossik
Copy link

Describe the bug
I have an instance of the Rating component. When I call dispose(), the error occurs:
image

Show your code
There is an Internal server error when I try to add a playgound, so this is my code:
import { Rating, initTE } from "tw-elements";

initTE({ Rating });

const diffRatingEl = document.getElementById('difficulty-rating');

let diffRating = new Rating(diffRatingEl);
diffRating.dispose();

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 118.0.5993.70

Additional context
I looked up the code of rating in node_modules\tw-elements\dist\src\js\components\rating.js:
this._icons.removeAttribute("tabIndex");
this._icons prop is supposed to be an array, so it's obvious that removeAttribute() is not a function, instead we should run this on every icon:
this._icons.forEach(el => el.removeAttribute("tabIndex"));

@Nikitossik Nikitossik changed the title [Rating] [dispose() method throws an error] [Rating] [dispose() method throws an error] Oct 16, 2023
@juujisai
Copy link
Contributor

Unfortunately this is a bug. I'm adding this issue to our project to-fix list. Thank you for letting us know

@juujisai juujisai added the bug label Oct 17, 2023
@juujisai juujisai added this to the v1.1.0 milestone Oct 17, 2023
@Trochonovitz Trochonovitz linked a pull request Nov 7, 2023 that will close this issue
@juujisai juujisai closed this as completed Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants