dequelabs / dequelabs/cauldron
Toast throws error and bails on rendering with unsupported type
- Dominant language
- TypeScript
- Stars
- 127
- Forks
- 31
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 8
Description
I think we should more gracefully handle this, the following error is thrown when an unsupported type is provided:
```js
TypeError: Cannot read property 'className' of undefined
```
https://github.com/dequelabs/cauldron/blob/475454d48d1c28b8f7f599df3361ad7be0ee07ec/packages/react/src/components/Toast/index.tsx#L110
Maybe default to a safe type, throw a console error, but still render?
Contributor guide
Research direction
Start in packages/react/src/components/Toast/index.tsx at the linked line and reproduce the failure by supplying an unsupported type. Trace how the type selects Toast styling and confirm the expected fallback or reporting behavior with the maintainers. Done means an unsupported type no longer throws while rendering the Toast.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100