Skip to content
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
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = {
require('@babel/preset-typescript'),
],
plugins: [
require('@babel/plugin-proposal-class-properties'),
require('@babel/plugin-proposal-object-rest-spread'),
require('@babel/plugin-transform-class-properties'),
require('@babel/plugin-transform-object-rest-spread'),
require('@babel/plugin-transform-modules-commonjs'),
],
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.16.5",
"@babel/plugin-transform-modules-commonjs": "^7.22.9",
"@elastic/elastic-eslint-config-kibana": "link:../../packages/opensearch-eslint-config-opensearch-dashboards",
"@elastic/eslint-import-resolver-kibana": "link:../../packages/osd-eslint-import-resolver-opensearch-dashboards",
"cypress": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion public/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const getDigitId = (length = 6) =>

// Assumes that values is an array of objects with "name" inside
export const getUniqueName = (values, prefix) => {
const lastValue = values.at(-1);
const lastValue = _.last(values);
Copy link
Collaborator Author

@AWSHurneyt AWSHurneyt Nov 18, 2023

Choose a reason for hiding this comment

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

For context, the following test started failing when executing yarn run test:jest. Refactored the .at() call to _.last().

 FAIL  public/components/FeatureAnywhereContextMenu/AddAlertingMonitor/CreateNew/CreateNew.test.js (24.469 s)
  ● CreateNew › renders

    TypeError: values.at is not a function

      78 |   const lastValue = values.at(-1);
         |                            ^
      81 |   const lastName = lastValue ? lastValue.name : '';
      82 |   const lastDigit = Number.parseInt(lastName.match(/\d+$/)?.[0] || 0, 10);
      83 |

      at getUniqueName (public/utils/helpers.js:80:12)
      at getInitialTriggerValues (public/pages/CreateTrigger/components/AddTriggerButton/utils.js:30:39)
      at getInitialValues (public/pages/CreateMonitor/containers/CreateMonitor/utils/helpers.js:49:51)
      at Object.<anonymous> (public/components/FeatureAnywhereContextMenu/AddAlertingMonitor/CreateNew/CreateNew.test.js:32:42)

const lastName = lastValue ? lastValue.name : '';
const lastDigit = Number.parseInt(lastName.match(/\d+$/)?.[0] || 0, 10);

Expand Down
Loading