Skip to content

Commit

Permalink
chore: Revert back react key. #484
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci committed Jul 7, 2021
1 parent 6e5bcd5 commit 444edef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/src/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import * as Fluent from '@fluentui/react'
import { B, Model, Packed, S, unpack } from 'h2o-wave'
import { B, Model, Packed, S, unpack, xid } from 'h2o-wave'
import React from 'react'
import { stylesheet } from 'typestyle'
import { Button, Buttons, XButtons, XStandAloneButton } from './button'
Expand Down Expand Up @@ -192,14 +192,14 @@ export enum XComponentAlignment { Top, Left, Right }
export const
XComponents = ({ items, alignment, inset }: { items: Component[], alignment?: XComponentAlignment, inset?: B }) => {
const
components = items.map((m: any, i) => {
components = items.map((m: any) => {
const
// All form items are wrapped by their component name (first and only prop of "m").
visible = m[Object.keys(m)[0]].visible ?? true,
visibleStyles: React.CSSProperties = visible ? {} : { display: 'none' }

return (
<div key={i} data-visible={visible} style={visibleStyles}>
<div key={xid()} data-visible={visible} style={visibleStyles}>
<XComponent model={m} />
</div>
)
Expand Down

0 comments on commit 444edef

Please sign in to comment.