Skip to content

Commit

Permalink
fix: preserve input-component format
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Sep 27, 2022
1 parent f7852e1 commit c0a8483
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/data-workspace/data-entry-cell/inner-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export function InnerWrapper({
input: { value },
meta: { invalid, active, data, dirty },
} = useField(fieldname, {
// by default undefined is formatted to ''
// this preserves the format used in the input-component
format: (v) => v,
subscription: {
value: true,
invalid: true,
Expand All @@ -75,13 +78,15 @@ export function InnerWrapper({

// initalize lastSyncedValue
useEffect(
() =>
() => {
form.mutators.setFieldData(fieldname, {
lastSyncedValue: value,
}),
})
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[]
)

const synced = dirty && data.lastSyncedValue === value
// Detect if this field is sending data
const dataValueParams = useDataValueParams({ deId, cocId })
Expand Down

0 comments on commit c0a8483

Please sign in to comment.