diff --git a/src/common/utils/getFullDocument.ts b/src/common/utils/getFullDocument.ts index 66b3095d..a0c3e357 100644 --- a/src/common/utils/getFullDocument.ts +++ b/src/common/utils/getFullDocument.ts @@ -1,6 +1,6 @@ import connector from '../../pageServices/connector'; -export const getFullDocument = async () => { +export const getFullDocument = async (): Promise => { const documentResult = await connector.attachContentScript(() => JSON.stringify(document.documentElement.outerHTML)); - return await documentResult[0].result; + return documentResult[0].result; }; diff --git a/src/features/filter/types/filter.types.ts b/src/features/filter/types/filter.types.ts index 488caa37..c15f68aa 100644 --- a/src/features/filter/types/filter.types.ts +++ b/src/features/filter/types/filter.types.ts @@ -5,16 +5,16 @@ export interface Filter extends FilterType { pageObjectId: PageObjectId; } +export enum FilterKey { + JDIclassFilter = 'JDIclassFilter', +} + export interface FilterType { [FilterKey.JDIclassFilter]: ClassFilterValue; } export type ClassFilterValue = Partial>; -export enum FilterKey { - JDIclassFilter = 'JDIclassFilter', -} - export interface JDIClassFilterValue { Checked: boolean; JDIclass: ElementClass; diff --git a/src/features/locators/utils/filterLocators.ts b/src/features/locators/utils/filterLocators.ts index bb9a9792..529eae29 100644 --- a/src/features/locators/utils/filterLocators.ts +++ b/src/features/locators/utils/filterLocators.ts @@ -4,9 +4,8 @@ import { ClassFilterValue } from '../../filter/types/filter.types'; export const filterLocatorsByClassFilter = (locators: ILocator[], filter: ClassFilterValue) => { if (!filter) return locators; - const _locators = locators?.filter((locator) => { - const filterValue = filter; - return Object.hasOwn(filterValue, locator.type) ? get(filterValue, locator.type) : true; + + return locators?.filter((locator) => { + return Object.hasOwn(filter, locator.type) ? get(filter, locator.type) : true; }); - return _locators; }; diff --git a/src/features/locators/utils/locatorsTreeUtils.ts b/src/features/locators/utils/locatorsTreeUtils.ts index 60cb334c..0a9557ec 100644 --- a/src/features/locators/utils/locatorsTreeUtils.ts +++ b/src/features/locators/utils/locatorsTreeUtils.ts @@ -75,7 +75,10 @@ export const convertListToTree = (_list: ILocator[], searchString = '') => { const treeParent = getParent(node.parent_id); const origDepth = (list[map[node.parent_id]].depth || 0) + 1; const children = treeParent.children; - children && children.push({ ...node, depth: origDepth }); + + if (children) { + children.push({ ...node, depth: origDepth }); + } } else { tree.push({ ...node, searchState }); } diff --git a/src/services/pageDocument/fetchPageDocument.thunk.ts b/src/services/pageDocument/fetchPageDocument.thunk.ts index ea17441c..68358778 100644 --- a/src/services/pageDocument/fetchPageDocument.thunk.ts +++ b/src/services/pageDocument/fetchPageDocument.thunk.ts @@ -5,7 +5,7 @@ import { PageDocumentState } from './pageDocument.slice'; export const fetchPageDocument = createAsyncThunk('pageDocument/fetchPageDocument', async (_, { rejectWithValue }) => { try { - const response: string = await getFullDocument(); + const response = await getFullDocument(); return response; } catch (error) { return rejectWithValue(error.response.data);