From 161f3d58055b05eb58e87315edd8a11d3b0f4837 Mon Sep 17 00:00:00 2001 From: WangQianliang Date: Sun, 18 Aug 2019 13:13:04 +0800 Subject: [PATCH] fix(code/frontend): button group url should have previous query string (#43428) (#43507) --- .../plugins/code/public/components/main/content.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/x-pack/legacy/plugins/code/public/components/main/content.tsx b/x-pack/legacy/plugins/code/public/components/main/content.tsx index 372be46e51aa0..7ad496e971674 100644 --- a/x-pack/legacy/plugins/code/public/components/main/content.tsx +++ b/x-pack/legacy/plugins/code/public/components/main/content.tsx @@ -135,26 +135,31 @@ class CodeContent extends React.PureComponent { public switchButton = (id: string) => { const { path, resource, org, repo, revision } = this.props.match.params; + const queryString = this.props.location.search; const repoUri = `${resource}/${org}/${repo}`; switch (id) { case ButtonOption.Code: history.push( - `/${repoUri}/${PathTypes.blob}/${encodeRevisionString(revision)}/${path || ''}` + `/${repoUri}/${PathTypes.blob}/${encodeRevisionString(revision)}/${path || + ''}${queryString}` ); break; case ButtonOption.Folder: history.push( - `/${repoUri}/${PathTypes.tree}/${encodeRevisionString(revision)}/${path || ''}` + `/${repoUri}/${PathTypes.tree}/${encodeRevisionString(revision)}/${path || + ''}${queryString}` ); break; case ButtonOption.Blame: history.push( - `/${repoUri}/${PathTypes.blame}/${encodeRevisionString(revision)}/${path || ''}` + `/${repoUri}/${PathTypes.blame}/${encodeRevisionString(revision)}/${path || + ''}${queryString}` ); break; case ButtonOption.History: history.push( - `/${repoUri}/${PathTypes.commits}/${encodeRevisionString(revision)}/${path || ''}` + `/${repoUri}/${PathTypes.commits}/${encodeRevisionString(revision)}/${path || + ''}${queryString}` ); break; }