Skip to content

Commit 98220b7

Browse files
committed
add relative pathname
1 parent 4a8a175 commit 98220b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/src/containers/Operations/Operation.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export const Operation: React.FunctionComponent<Props> = (props) => {
4040
channel.parameters() !== undefined
4141
? SchemaHelpers.parametersToSchema(channel.parameters())
4242
: undefined;
43-
43+
// Construct the full relative URL, including path, query parameters to avoid path overwrite when
44+
// location.hash is included
45+
const relativePathname = `${window.location.pathname}${window.location.search}`;
4446
return (
4547
<div>
4648
<div className="panel-item--center px-8">
@@ -53,7 +55,7 @@ export const Operation: React.FunctionComponent<Props> = (props) => {
5355
{servers.map((server) => (
5456
<li className="inline-block mt-2 mr-2" key={server.id()}>
5557
<a
56-
href={`${window.location.pathname}#${CommonHelpers.getIdentifier(
58+
href={`${relativePathname}#${CommonHelpers.getIdentifier(
5759
'server-' + server.id(),
5860
config,
5961
)}`}

0 commit comments

Comments
 (0)