Skip to content

Commit

Permalink
fix: remove self from siblings (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb committed Jan 5, 2024
1 parent 19956fb commit 7a8d8e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion workspace/marqua/src/fs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export function traverse(
const backpack = tree.flatMap(({ type, breadcrumb, buffer }) => {
const path = [...breadcrumb].reverse().join('/');
if (type === 'file' && files(path)) {
return hydrate({ breadcrumb, buffer, marker, parse, siblings: tree }) ?? [];
const siblings = tree.filter(
({ breadcrumb }) => [...breadcrumb].reverse().join('/') !== path,
);
return hydrate({ breadcrumb, buffer, marker, parse, siblings }) ?? [];
} else if (level !== 0) {
const depth = level < 0 ? level : level - 1;
return traverse({ entry: path, depth, files }, hydrate);
Expand Down
1 change: 0 additions & 1 deletion workspace/marqua/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface HydrateChunk {
buffer: Buffer;
marker: typeof marker;
parse: typeof parse;
// TODO: remove self from siblings
siblings: Array<
| { type: 'file'; breadcrumb: string[]; buffer: Buffer }
| { type: 'directory'; breadcrumb: string[]; buffer: undefined }
Expand Down

1 comment on commit 7a8d8e0

@vercel
Copy link

@vercel vercel bot commented on 7a8d8e0 Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.