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

bug/issue 340 Shelf's First Nav Item Expanding By Default #344

Merged
merged 2 commits into from
May 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion www/components/shelf/shelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class Shelf extends LitElement {
expandRoute(path) {
// find list item containing current window.location.pathname
let routeShelfListIndex = this.shelfList.findIndex(list => {
return list.item.link.indexOf(path) >= 0;
let expRoute = new RegExp(`^${path}$`);
Copy link
Member

@thescientist13 thescientist13 May 1, 2020

Choose a reason for hiding this comment

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

ah... I think this has been a solution i've been looking for, wherever we have to do this sort of pattern matching for current route like in app-template.js and could help fix our missing forward / issue?

Basically anywhere else we are doing something like this

const route = window.location.pathname;

const currentPage = response[1].data.graph.filter((page) => {
  return route === page.link;
})[0];

return expRoute.test(list.item.link);
});

if (routeShelfListIndex > -1) {
Expand Down