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.context.snippet.update(this.props.snippet.id, this.state).then(() =>
this.props.setToasts({ this.props.setToasts({
type: 'SET', type: 'SET',
toast: [{ children: 'Snippet saved', timeout: 3000 }], toasts: [{ children: 'Snippet saved', timeout: 3000 }],
}) })
) )

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

Loading…
Cancel
Save