Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert numeric options to strings to silence ui-core warnings #617

Merged
merged 3 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/app/src/modules/current.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ export const getOptionsFromUi = ui => {
})

// cast option values to Number for some options
;['sortOrder', 'topLimit'].forEach(option => {
if (Object.prototype.hasOwnProperty.call(optionsFromUi, option)) {
optionsFromUi[option] = Number(optionsFromUi[option])
;['baseLineValue', 'targetLineValue', 'sortOrder', 'topLimit'].forEach(
option => {
if (Object.prototype.hasOwnProperty.call(optionsFromUi, option)) {
optionsFromUi[option] = Number(optionsFromUi[option])
janhenrikoverland marked this conversation as resolved.
Show resolved Hide resolved
}
}
})
)

return optionsFromUi
}
Expand Down
10 changes: 6 additions & 4 deletions packages/app/src/modules/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ export const getOptionsFromVisualization = visualization => {
}

// cast option values from Number for some options
;['sortOrder', 'topLimit'].forEach(option => {
if (Object.prototype.hasOwnProperty.call(visualization, option)) {
optionsFromVisualization[option] = String(visualization[option])
;['baseLineValue', 'targetLineValue', 'sortOrder', 'topLimit'].forEach(
option => {
if (Object.prototype.hasOwnProperty.call(visualization, option)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not just if (visualization.hasOwnProperty(option)) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter complains about that form.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionsFromVisualization[option] = String(visualization[option])
}
}
})
)

return optionsFromVisualization
}