Skip to content

Commit

Permalink
Show all parents of a request that matches a filter (Kong#6983)
Browse files Browse the repository at this point in the history
  • Loading branch information
gatzjames authored and jackkav committed Mar 13, 2024
1 parent 518ede8 commit f037d90
Showing 1 changed file with 18 additions and 1 deletion.
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

0 comments on commit f037d90

Please sign in to comment.