dequelabs / dequelabs/cauldron

Toast throws error and bails on rendering with unsupported type

Open
#59 0 comments 0 reactions 0 assignees View on GitHub
bug medium
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.