Skip to content

Commit

Permalink
fix(surround): respect only and without filters (#2311)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Sep 15, 2023
1 parent 9ef8bd9 commit 604b881
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/query/match/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ export function createPipelineFetcher<T> (getContentsList: () => Promise<T[]>) {
(state, params) => ensureArray(params.sort).forEach(options => sortList(state.result, options!)),
function fetchSurround (state, params, db) {
if (params.surround) {
let _surround = surround(state.result?.length === 1 ? db : state.result, params.surround)

_surround = apply(withoutKeys(params.without))(_surround)
_surround = apply(withKeys(params.only))(_surround)

// @ts-ignore
state.surround = surround(state.result?.length === 1 ? db : state.result, params.surround)
state.surround = _surround
}
return state
}
Expand Down

0 comments on commit 604b881

Please sign in to comment.