[ic-date-picker] - Switching theme in Storybook causes the date-picker to be duplicated
- Dominant language
- TypeScript
- Stars
- 53
- Forks
- 63
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 15
Description
### Summary of the bug
Similar to https://github.com/mi6/ic-ui-kit/issues/3927.
The issue is caused by the use of document.createElement without checking if the element already exists
### 🪜 How to reproduce
Tell us the steps to reproduce the problem:
1. Go to any datepicker Storybook example in canary web components eg https://mi6.github.io/ic-ui-kit/branches/canary/develop/web-components/?path=/story/web-components-date-picker--default-example
2. Click light mode toggle to go to dark mode
3.Click again to go back to light mode
4. See the error - there is an additional date-picker rendered on the page. repeatedly changing theme causes more to be added
### 🧐 Expected behaviour
Date picker should not be duplicated on the page
### 🚨 Urgency (low, medium or high)
Medium - previous data-table ticket was a medium priority
Contributor guide
Research direction
Start with the date-picker Storybook example linked in the issue and reproduce the problem by toggling light and dark mode repeatedly. Inspect the date-picker's document.createElement usage, then verify that switching themes leaves exactly one date-picker rendered on the page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100