Skip to content

Commit f578d43

Browse files
committed
replace uuid with randomUUID
1 parent 9d24649 commit f578d43

File tree

9 files changed

+48
-52
lines changed

9 files changed

+48
-52
lines changed

DEV.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,4 @@ https://www.kickstarter.com/projects/curtisclow/the-wild-cosmos-1-3-a-sci-fi-fan
183183
- Debug with redux devtools to see what actions are being dispatched and how long they take
184184
- Add better trackBy functions for `*ngFor` directives
185185
- memoize expensive functions
186+
- Use observable to manage complex logic instead of calling functions in template

packages/altair-app/src/app/modules/altair/components/add-collection-query-dialog/add-collection-query-dialog.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
name="collection"
2828
nzPlaceHolder="Choose"
2929
>
30-
@for (collection of collections; track trackById($index, collection)) {
30+
@for (collection of collections; track collection.id) {
3131
<nz-option
3232
[nzValue]="collection.id"
3333
[nzLabel]="collection.title"
@@ -80,7 +80,7 @@
8080
name="workspace"
8181
nzPlaceHolder="Choose"
8282
>
83-
@for (workspace of workspaces; track trackById($index, workspace)) {
83+
@for (workspace of workspaces; track workspace.id) {
8484
<nz-option
8585
[nzValue]="workspace.id"
8686
[nzLabel]="workspace.label"

packages/altair-app/src/app/modules/altair/components/authorization/authorization-editor/authorization-editor.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<nz-form-label>{{ 'AUTHORIZATION_TYPE_TEXT' | translate }}</nz-form-label>
55
<nz-form-control [nzSm]="8" nzErrorTip="The input is not a valid type!">
66
<nz-select formControlName="type">
7-
@for (item of AUTH_TYPES; track $index) {
7+
@for (item of AUTH_TYPES; track item) {
88
<nz-option
99
[nzValue]="item"
1010
[nzLabel]="AUTH_MAPPING[item].copy | translate"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@for (banner of banners$ | async; track $index) {
1+
@for (banner of banners$ | async; track banner.id) {
22
<app-banner [banner]="banner" (dismiss)="onDismiss($event)"></app-banner>
33
}

packages/altair-app/src/app/modules/altair/components/doc-viewer/doc-viewer-field/doc-viewer-field.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<div class="doc-viewer-section-title">
3737
{{ 'DOCS_ARGUMENTS_TEXT' | translate }}
3838
</div>
39-
@for (arg of data.args; track argTrackBy($index, arg)) {
39+
@for (arg of data.args; track arg.name) {
4040
<div class="doc-viewer-item doc-viewer-item-query">
4141
<div class="doc-viewer-item-query-inner">
4242
<span class="no-link-link" (click)="goToType(arg.type.inspect())">

packages/altair-app/src/app/modules/altair/components/doc-viewer/doc-viewer-search-results/doc-viewer-search-results.component.html

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class="doc-viewer-search-result-item"
99
(click)="goToItem(result)"
1010
[@showResultItem]
11-
>
11+
>
1212
@switch (result.cat) {
1313
@case ('type') {
1414
<span class="doc-viewer-search-result-cat cat-type">{{
@@ -17,15 +17,14 @@
1717
}
1818
@case ('field') {
1919
@if (result.isQuery) {
20-
<span
21-
class="doc-viewer-search-result-cat cat-query"
22-
>{{ getProperName(result.type || '') }}</span>
20+
<span class="doc-viewer-search-result-cat cat-query">{{
21+
getProperName(result.type || '')
22+
}}</span>
2323
}
2424
@if (!result.isQuery) {
25-
<span
26-
class="doc-viewer-search-result-cat cat-field"
27-
>{{ 'DOCS_FIELD_TEXT' | translate }}</span
28-
>
25+
<span class="doc-viewer-search-result-cat cat-field">{{
26+
'DOCS_FIELD_TEXT' | translate
27+
}}</span>
2928
}
3029
}
3130
}
@@ -35,38 +34,37 @@
3534
class="doc-viewer-search-result-parent-type"
3635
(click)="goToItem(result)"
3736
>{{ result.type }}.</span
37+
>
38+
}
39+
<span
40+
[ngClass]="{
41+
'doc-viewer-search-result-highlight': result.highlight !== 'argument',
42+
}"
43+
>{{ result.name }}</span
44+
>
45+
@if (result.args && result.args.length) {
46+
(
47+
@for (arg of result.args; track arg.name; let last = $last) {
48+
<span
49+
[ngClass]="{
50+
'doc-viewer-search-result-highlight':
51+
result.highlight === 'argument',
52+
}"
3853
>
39-
}<span
40-
[ngClass]="{
41-
'doc-viewer-search-result-highlight': result.highlight !== 'argument'
42-
}"
43-
>{{ result.name }}</span
44-
>
45-
@if (result.args && result.args.length) {
46-
(
47-
@for (
48-
arg of result.args; track resultArgTrackBy($index,
49-
arg); let last = $last) {
50-
<span
51-
[ngClass]="{
52-
'doc-viewer-search-result-highlight':
53-
result.highlight === 'argument'
54-
}"
55-
>
56-
<span>{{ arg.name }}</span
57-
>@if (!last) {
58-
<span>,</span>
59-
}
60-
</span>
54+
<span>{{ arg.name }}</span>
55+
@if (!last) {
56+
<span>,</span>
6157
}
62-
)
63-
}
64-
</div>
65-
<div
66-
class="doc-viewer-search-result-description"
67-
markdown
68-
[data]="result.description"
69-
></div>
70-
</div>
71-
}
58+
</span>
59+
}
60+
)
61+
}
62+
</div>
63+
<div
64+
class="doc-viewer-search-result-description"
65+
markdown
66+
[data]="result.description"
67+
></div>
7268
</div>
69+
}
70+
</div>

packages/altair-app/src/app/modules/altair/components/doc-viewer/doc-viewer/doc-viewer.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
[nzDefaultActiveFirstOption]="false"
8080
(selectionChange)="searchDocs(autocompleteInput.value)"
8181
>
82-
@for (option of autocompleteOptions; track option) {
82+
@for (option of autocompleteOptions; track $index) {
8383
<nz-auto-option [nzValue]="option" [nzLabel]="option.search">
8484
<div class="doc-viewer-autocomplete-item">
8585
{{ option.search }}
@@ -99,7 +99,7 @@
9999
<div>
100100
@switch (docView.view) {
101101
@case ('root') {
102-
@for (item of rootTypes; track rootTypeTrackBy($index, item)) {
102+
@for (item of rootTypes; track item.name) {
103103
<div class="doc-viewer-item">
104104
@if (item) {
105105
<span class="no-link-link" (click)="goToType(item.name)">{{

packages/altair-core/jest.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@ module.exports = {
99
},
1010
coverageDirectory: '<rootDir>/.coverage',
1111
collectCoverage: true,
12-
transformIgnorePatterns: [
13-
'node_modules/.pnpm/(?!@angular|@firebase|@ngrx|@sentry|lodash-es|altair-graphql-core|angular-resizable-element|angular-split|dexie|uuid|ngx-cookie-service|ngx-markdown|ky|color-name|json-schema-library|graphql-language-service|vscode-languageserver-types|cm6-graphql|ngx-toastr|@ngx-translate|lucide-angular|ng-zorro-antd|@ant-design\\+icons-angular|ngx-pipes)',
14-
],
12+
transformIgnorePatterns: ['node_modules/.pnpm/(?!uuid|ngx-pipes)'],
1513
};

packages/altair-core/src/script/context.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
ScriptContextResponse,
99
} from './types';
1010
import { get, set } from 'object-path';
11-
import { v4 as uuid } from 'uuid';
1211

1312
export const ModuleImports: ModuleImportsMap = {
1413
atob: {
@@ -98,7 +97,7 @@ export const getGlobalContext = (
9897
log: (d) => {
9998
data.requestScriptLogs = data.requestScriptLogs ?? [];
10099
data.requestScriptLogs.push({
101-
id: uuid(),
100+
id: crypto.randomUUID(),
102101
time: Date.now(),
103102
text: JSON.stringify(d, null, 2),
104103
source: 'Request script',

0 commit comments

Comments
 (0)