From 87792f5911090af39ffa3fffda5daf7040ab3bfc Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sat, 25 Jan 2020 08:45:31 -0500 Subject: [PATCH] Fix Button component not working because of attrs.children being frozen --- js/src/common/components/Button.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/js/src/common/components/Button.tsx b/js/src/common/components/Button.tsx index b8fd1a8af..3eeb345d8 100644 --- a/js/src/common/components/Button.tsx +++ b/js/src/common/components/Button.tsx @@ -32,10 +32,7 @@ export interface ButtonProps extends ComponentProps { */ export default class Button extends Component { view(vnode) { - const attrs: ButtonProps = vnode.attrs; - const children = attrs.children; - - delete attrs.children; + const { children, ...attrs} = vnode.attrs; attrs.className = attrs.className || ''; attrs.type = attrs.type || 'button'; @@ -50,7 +47,7 @@ export default class Button extends Compone const loading = extract(attrs, 'loading'); if (attrs.disabled || loading) { - attrs.className += ' disabled' + (loading ? ' loading' : ''); + attrs.className += ' ' + classNames('disabled', loading && 'loading'); delete attrs.onclick; }