Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
e-fisher committed Jan 14, 2025
1 parent 36bfd8a commit 94a5fc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
22 changes: 10 additions & 12 deletions src/components/WebLogView/Details.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ interface DetailsTabStore {
setTab: (tab: string) => void
}

// TODO: remove duplication OR merge into single stores
export const useRequestDetailsTab = create<DetailsTabStore>((set) => ({
tab: 'headers',
setTab: (tab) => set({ tab }),
}))
function createDetailsTabStore() {
return create<DetailsTabStore>((set) => ({
tab: 'headers',
setTab: (tab) => set({ tab }),
}))
}

export const useResponseDetailsTab = create<DetailsTabStore>((set) => ({
tab: 'headers',
setTab: (tab) => set({ tab }),
}))
export const useRequestDetailsTab = createDetailsTabStore()
export const useResponseDetailsTab = createDetailsTabStore()

// TODO: rename
interface Store {
interface ContentMatchStore {
searchString?: string
index: number
goToMatch: ({
Expand All @@ -31,7 +29,7 @@ interface Store {
}

function createStore() {
return create<Store>((set) => ({
return create<ContentMatchStore>((set) => ({
searchString: undefined,
index: 0,
goToMatch: ({ searchString, index }) =>
Expand Down
4 changes: 1 addition & 3 deletions src/components/WebLogView/Filter.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ export function useFilterRequests({
}

// Use '<query> to search for exact matches
const rez = searchIndex.search(`'"${debouncedFilter}"`)
console.log('rez', rez)
return rez.map(withMatches)
return searchIndex.search(`'"${debouncedFilter}"`).map(withMatches)
}, [searchIndex, assetsToFilter, debouncedFilter])

const staticAssetCount = proxyData.length - requestWithoutStaticAssets.length
Expand Down

0 comments on commit 94a5fc4

Please sign in to comment.