@parca/profile 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.10.0](https://github.com/parca-dev/parca/compare/ui-v0.9.3...ui-v0.10.0) (2022-02-28)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.9.3](https://github.com/parca-dev/parca/compare/ui-v0.8.0...ui-v0.9.3) (2022-02-23)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
14
+ ## [0.9.2](https://github.com/parca-dev/parca/compare/ui-v0.9.1...ui-v0.9.2) (2022-02-22)
15
+
16
+ **Note:** Version bump only for package @parca/profile
17
+
6
18
  ## [0.9.1](https://github.com/parca-dev/parca/compare/ui-v0.9.0...ui-v0.9.1) (2022-02-21)
7
19
 
8
20
  ## [0.8.2](https://github.com/parca-dev/parca/compare/ui-v0.8.1...ui-v0.8.2) (2022-02-14)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
- "@parca/client": "^0.9.1",
7
- "@parca/dynamicsize": "^0.9.0",
8
- "@parca/parser": "^0.9.0",
6
+ "@parca/client": "^0.10.0",
7
+ "@parca/dynamicsize": "^0.10.0",
8
+ "@parca/parser": "^0.10.0",
9
9
  "d3-scale": "^4.0.2"
10
10
  },
11
11
  "main": "src/index.tsx",
@@ -19,5 +19,5 @@
19
19
  "access": "public",
20
20
  "registry": "https://registry.npmjs.org/"
21
21
  },
22
- "gitHead": "3f24c77e47a520b6b2343e27621401cc2ef933c0"
22
+ "gitHead": "5ec1e79324d80272b4bae300bcec3162687d3e92"
23
23
  }
@@ -1,20 +1,23 @@
1
1
  import React, {useEffect, useState} from 'react';
2
- import {useRouter} from 'next/router';
3
-
4
2
  import {CalcWidth} from '@parca/dynamicsize';
3
+ import {parseParams} from '@parca/functions';
4
+ import {QueryRequest, QueryResponse, QueryServiceClient, ServiceError} from '@parca/client';
5
+ import Button from '@parca/web/src/components/ui/Button';
6
+ import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
7
+
5
8
  import ProfileIcicleGraph from './ProfileIcicleGraph';
6
9
  import {ProfileSource} from './ProfileSource';
7
- import {QueryRequest, QueryResponse, QueryServiceClient, ServiceError} from '@parca/client';
8
10
  import Card from '../../../app/web/src/components/ui/Card';
9
- import Button from '@parca/web/src/components/ui/Button';
10
11
  import TopTable from './TopTable';
11
- import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
12
12
 
13
13
  import './ProfileView.styles.css';
14
14
 
15
+ type NavigateFunction = (path: string, queryParams: any) => void;
16
+
15
17
  interface ProfileViewProps {
16
18
  queryClient: QueryServiceClient;
17
19
  profileSource: ProfileSource;
20
+ navigateTo?: NavigateFunction;
18
21
  }
19
22
 
20
23
  export interface IQueryResult {
@@ -55,9 +58,13 @@ export const useQuery = (
55
58
  return result;
56
59
  };
57
60
 
58
- export const ProfileView = ({queryClient, profileSource}: ProfileViewProps): JSX.Element => {
59
- const router = useRouter();
60
- const currentViewFromURL = router.query.currentProfileView as string;
61
+ export const ProfileView = ({
62
+ queryClient,
63
+ profileSource,
64
+ navigateTo,
65
+ }: ProfileViewProps): JSX.Element => {
66
+ const router = parseParams(window.location.search);
67
+ const currentViewFromURL = router.currentProfileView as string;
61
68
  const [curPath, setCurPath] = useState<string[]>([]);
62
69
  const {response, error} = useQuery(queryClient, profileSource);
63
70
  const [currentView, setCurrentView] = useState<string | undefined>(currentViewFromURL);
@@ -141,14 +148,12 @@ export const ProfileView = ({queryClient, profileSource}: ProfileViewProps): JSX
141
148
  }
142
149
  };
143
150
 
144
- const queryParams = router.query;
145
-
146
151
  const switchProfileView = (view: string) => {
152
+ if (!navigateTo) return;
153
+
147
154
  setCurrentView(view);
148
- router.push({
149
- pathname: '/',
150
- query: {...queryParams, ...{currentProfileView: view}},
151
- });
155
+
156
+ navigateTo('/', {...router, ...{currentProfileView: view}});
152
157
  };
153
158
 
154
159
  return (