Skip to content

Commit

Permalink
defensive toasts
Browse files Browse the repository at this point in the history
Closes #1376
  • Loading branch information
mfix22 committed May 16, 2022
1 parent 031edd9 commit 6df5e12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class Editor extends React.Component {
this.context.snippet.update(this.props.snippet.id, this.state).then(() =>
this.props.setToasts({
type: 'SET',
toast: [{ children: 'Snippet saved', timeout: 3000 }],
toasts: [{ children: 'Snippet saved', timeout: 3000 }],
})
)

Expand Down
10 changes: 5 additions & 5 deletions components/Toasts.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ function ToastContainer(props) {
return (
<div className="toast">
{props.toasts
.slice()
.reverse()
.map(toast => (
<Toast key={toast.children} {...toast} />
))}
? props.toasts
.slice()
.reverse()
.map(toast => <Toast key={toast.children} {...toast} />)
: null}
<style jsx>
{`
.toast {
Expand Down

0 comments on commit 6df5e12

Please sign in to comment.