Skip to content
代码片段 群组 项目
提交 c825dcf0 编辑于 作者: Anton Kalmykov's avatar Anton Kalmykov
浏览文件

Use a default value for the parameter that will be parsed by JSON.parse

This commit aims to prevent unnecessary error logging to the Sentry
caused by JSON.parse when the given value is `undefined`

Closes: https://gitlab.com/gitlab-org/gitlab/-/issues/490960
Changelog: changed
上级 a0abf326
No related branches found
No related tags found
无相关合并请求
......@@ -8,8 +8,9 @@ export const initAccessDropdown = (el, options) => {
}
const { accessLevelsData, ...props } = options;
const { label, disabled, preselectedItems } = el.dataset || {};
const { label, disabled, preselectedItems = '[]' } = el.dataset || {};
let preselected = [];
try {
preselected = JSON.parse(preselectedItems);
} catch (e) {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册