Commit 8dcbe92c authored by Mike Greiling's avatar Mike Greiling

Merge branch 'ph/vueLogTreeApolloCache' into 'master'

Correctly caches log tree calls in Apollo client

See merge request gitlab-org/gitlab!19382
parents aacca248 fd2a7bc0
......@@ -37,7 +37,7 @@ export function fetchLogsTree(client, path, offset, resolver = null) {
const { ref } = client.readQuery({ query: getRef });
fetchpromise = axios
.get(`${gon.gitlab_url}/${projectPath}/refs/${ref}/logs_tree${path ? `/${path}` : ''}`, {
.get(`${gon.gitlab_url}/${projectPath}/refs/${ref}/logs_tree/${path.replace(/^\//, '')}`, {
params: { format: 'json', offset },
})
.then(({ data, headers }) => {
......
......@@ -16,7 +16,7 @@ export default function createRouter(base, baseRef) {
name: 'treePath',
component: TreePage,
props: route => ({
path: route.params.pathMatch && route.params.pathMatch.replace(/^\//, ''),
path: route.params.pathMatch && (route.params.pathMatch.replace(/^\//, '') || '/'),
}),
},
{
......
......@@ -81,7 +81,7 @@ describe('fetchLogsTree', () => {
it('calls axios get', () =>
fetchLogsTree(client, '', '0', resolver).then(() => {
expect(axios.get).toHaveBeenCalledWith(
'https://test.com/gitlab-org/gitlab-foss/refs/master/logs_tree',
'https://test.com/gitlab-org/gitlab-foss/refs/master/logs_tree/',
{ params: { format: 'json', offset: '0' } },
);
}));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment