defensive toasts

Closes #1376
main
Mike Fix 3 years ago
parent 031edd9835
commit 6df5e126bd
No known key found for this signature in database
GPG Key ID: 1D85E862314CA79F

@ -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 }],
})
)

@ -94,11 +94,11 @@ function ToastContainer(props) {
return (
<div className="toast">
{props.toasts
? props.toasts
.slice()
.reverse()
.map(toast => (
<Toast key={toast.children} {...toast} />
))}
.map(toast => <Toast key={toast.children} {...toast} />)
: null}
<style jsx>
{`
.toast {

Loading…
Cancel
Save