Skip to content

Commit

Permalink
Fixed Data Editor turning NULL values into empty strings when editing…
Browse files Browse the repository at this point in the history
… a row. Fixes #978
  • Loading branch information
mpscholten committed Oct 13, 2021
1 parent 0244557 commit e473261
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions IHP/IDE/Data/View/EditRow.hs
Expand Up @@ -187,7 +187,7 @@ instance View EditRowView where
id={get #columnName def <> "-sqlbox"}
type="checkbox"
name={get #columnName def <> "_"}
checked={isSqlFunction_ (value val)}
checked={isSQLMode}
class="mr-1"
onclick={"sqlModeCheckbox('" <> get #columnName def <> "', this)"}
/>
Expand All @@ -200,5 +200,11 @@ instance View EditRowView where
/>
</div>
</div>|]
where
isNull = isNothing (get #fieldValue val)
isSQLMode = isSqlFunction_ (value val) || isNull

value val = fromMaybe BS.empty (get #fieldValue val)
value :: DynamicField -> ByteString
value dynamicField = case get #fieldValue dynamicField of
Just string -> string
Nothing -> "NULL"

0 comments on commit e473261

Please sign in to comment.