Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sidebar-search): Show all parents of a request that matches the search filter #6983

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion packages/insomnia/src/ui/routes/workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,23 @@ export const workspaceLoader: LoaderFunction = async ({

const workspaces = await models.workspace.findByParentId(projectId);

const collection = flattenTree();

// If there is a filter then we need to show all the parents of the requests that are not hidden.
collection.forEach(node => {
const ancestors = node.ancestors || [];

if (!node.hidden) {
ancestors.forEach(ancestorId => {
const ancestor = collection.find(n => n.doc._id === ancestorId);

if (ancestor) {
ancestor.hidden = false;
}
});
}
});

return {
workspaces,
activeWorkspace,
Expand All @@ -255,7 +272,7 @@ export const workspaceLoader: LoaderFunction = async ({
requestTree,
// TODO: remove this state hack when the grpc responses go somewhere else
grpcRequests: grpcReqs,
collection: flattenTree(),
collection,
};
};

Expand Down