Skip to content

Commit

Permalink
Fix use of disableComponents action metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
esurface committed Aug 26, 2024
1 parent e0ea6dd commit c0308c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v4.45.3

Fix undefined access of input without tagName

## v4.45.2

Fix check for 'readOnly' input metadata
Expand Down
8 changes: 5 additions & 3 deletions tangy-form-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ const tangyFormReducer = function (state = initialState, action) {
}
props.inputs = item.inputs.map(input => {
const inputMeta = itemMeta.inputs.find(inputMeta => inputMeta.name === input.name)
if(action.meta.disableComponents && action.meta.disableComponents.length > 0) {
inputMeta.disabled = action.meta.disableComponents.find(e => e.toLowerCase() === input.tagName.toLowerCase())
inputMeta.readOnly = inputMeta.disabled
if (input.tagName && action.meta.disableComponents && action.meta.disableComponents.length > 0) {
if (action.meta.disableComponents.find(e => e.toLowerCase === input.tagName.toLowerCase())) {
inputMeta.disabled = true
inputMeta.readOnly = true
}
}
return Object.assign({}, input,
{
Expand Down

0 comments on commit c0308c5

Please sign in to comment.