Skip to content

fix: uRL handling to include query params #1138

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions library/src/containers/Operations/Operation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ interface Props {
channel: ChannelInterface;
}

// Construct the full relative URL, including path, query parameters to avoid path overwrite when
// location.hash is included
const relativePathname = `${window.location.pathname}${window.location.search}`;

export const Operation: React.FunctionComponent<Props> = (props) => {
const { type = PayloadType.SEND, operation, channelName, channel } = props;
const config = useConfig();
Expand All @@ -40,7 +44,6 @@ export const Operation: React.FunctionComponent<Props> = (props) => {
channel.parameters() !== undefined
? SchemaHelpers.parametersToSchema(channel.parameters())
: undefined;

return (
<div>
<div className="panel-item--center px-8">
Expand All @@ -53,7 +56,7 @@ export const Operation: React.FunctionComponent<Props> = (props) => {
{servers.map((server) => (
<li className="inline-block mt-2 mr-2" key={server.id()}>
<a
href={`${window.location.pathname}#${CommonHelpers.getIdentifier(
href={`${relativePathname}#${CommonHelpers.getIdentifier(
'server-' + server.id(),
config,
)}`}
Expand Down Expand Up @@ -406,7 +409,7 @@ export const OperationReplyChannelInfo: React.FunctionComponent<Props> = ({
{servers.map((server) => (
<li className="inline-block mt-2 mr-2" key={server.id()}>
<a
href={`${window.location.pathname}#${CommonHelpers.getIdentifier(
href={`${relativePathname}#${CommonHelpers.getIdentifier(
'server-' + server.id(),
config,
)}`}
Expand Down