Skip to content
Merged
Changes from 1 commit
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
20 changes: 17 additions & 3 deletions app/client/src/pages/common/SearchBar/EntitySearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,23 @@ function EntitySearchBar(props: any) {
const defaultPage = searchedApplication?.pages.find(
(page: PageDefaultMeta) => page.isDefault === true,
);
const viewURL = viewerURL({
basePageId: defaultPage.baseId,
});

const isGitEnabled = searchedApplication?.gitApplicationMetadata;
Comment thread
brayn003 marked this conversation as resolved.
Outdated
let viewURL = null;

if (isGitEnabled) {
const defaultBranch =
searchedApplication?.gitApplicationMetadata?.defaultBranchName;

viewURL = viewerURL({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@brayn003 Out of curiosity, shouldn't the routeBuilder have taken care of this routing? This way, we would have been sure that all instances of this route builder are routing accurately and are taking the Git default branch into account. Can you help me understand why that is either not possible, or complicated?

basePageId: defaultPage.baseId,
branch: defaultBranch,
});
} else {
viewURL = viewerURL({
basePageId: defaultPage.baseId,
});
}
Comment thread
brayn003 marked this conversation as resolved.

window.location.href = `${viewURL}`;
}
Expand Down