diff --git a/src/commons/hooks/useDisableJsonKey.tsx b/src/commons/hooks/useDisableJsonKey.tsx index 6dd8884e28..cb975c6623 100644 --- a/src/commons/hooks/useDisableJsonKey.tsx +++ b/src/commons/hooks/useDisableJsonKey.tsx @@ -23,7 +23,8 @@ const useDisableJsonKey = (data: unknown): { trigger: () => void; keyRenderer: J return ; }; keyRenderer.when = ({ path }) => { - const num = Number(path[path.length - 1]); + const newNum = path.filter((i) => typeof i === "number"); + const num = Number(newNum[newNum.length - 1]); return !isNaN(num) && num < MAX_INDEX; }; return { keyRenderer, trigger };