@servicetitan/docs-uikit 37.0.0 → 37.0.2
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/docs/ai-marketplace.mdx
CHANGED
|
@@ -91,6 +91,8 @@ Shared uikit skills for ServiceTitan repos.
|
|
|
91
91
|
| :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
92
92
|
| `check-shai-hulud` | Scan a developer machine for indicators of compromise from the 2026-05-19 Mini Shai-Hulud npm supply chain attack |
|
|
93
93
|
| `check-supply-chain` | Scan a developer machine for signs of npm supply chain compromise; routes to wave-specific skills such as `check-shai-hulud` |
|
|
94
|
+
| `fix-cancelable-requests` | Find and fix Axios call sites that don't handle cancellation errors, in repos that use `initAjaxHandlers` from `@servicetitan/ajax-handlers` |
|
|
95
|
+
| `migrating-to-typescript-6` | Apply the mechanical TypeScript 6 fixes after upgrading to `@servicetitan/startup` >= 37.0.0, and report remaining type errors for manual resolution |
|
|
94
96
|
| `running-startup-commands` | Run tests, lint, and builds via the `startup` CLI in projects that depend on `@servicetitan/startup` |
|
|
95
97
|
| `spell-check` | Check for spelling errors in code changes |
|
|
96
98
|
| `switching-to-pnpm` | Migrate a project from npm to pnpm (see [migration guide](/docs/frontend/switching-to-pnpm)) |
|
|
@@ -6,6 +6,10 @@ title: AJAX Handlers
|
|
|
6
6
|
|
|
7
7
|
`@servicetitan/ajax-handlers` provides utilities for handling AJAX requests, authentication, and response processing in ServiceTitan applications. It includes automatic date parsing, authentication wrappers for protected resources, and comprehensive error handling.
|
|
8
8
|
|
|
9
|
+
:::caution
|
|
10
|
+
See [Cancelation handling](./cancelation-handling.mdx) for how to handle cancelable requests.
|
|
11
|
+
:::
|
|
12
|
+
|
|
9
13
|
## API
|
|
10
14
|
|
|
11
15
|
- [withMicroservice](./with-microservice.mdx) - Use to wrap components and authenticate requests to protected resources with support for Bearer and Token Server authentication.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Cancelation handling
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
When a request is canceled via `CancelToken` or `AbortController`, `initAjaxHandlers` rejects the promise with the cancelation error. Code that makes cancelable requests must handle this error to avoid unhandled promise rejections and spurious error UI.
|
|
6
|
+
|
|
7
|
+
Use `axios.isCancel` to distinguish cancelations from real errors:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
|
|
12
|
+
async loadData() {
|
|
13
|
+
this.cancelToken?.cancel();
|
|
14
|
+
this.cancelToken = axios.CancelToken.source();
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const res = await this.api.getData(this.cancelToken.token);
|
|
18
|
+
runInAction(() => { this.data = res.data; });
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (!axios.isCancel(e)) {
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If loading state is set before the `await`, reset it in a `finally` block so it clears even when the request is canceled:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
this.isLoading = true;
|
|
31
|
+
try {
|
|
32
|
+
const res = await this.api.getData(this.cancelToken.token);
|
|
33
|
+
runInAction(() => {
|
|
34
|
+
this.data = res.data;
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
if (!axios.isCancel(e)) {
|
|
38
|
+
throw e;
|
|
39
|
+
}
|
|
40
|
+
} finally {
|
|
41
|
+
this.isLoading = false;
|
|
42
|
+
}
|
|
43
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/docs-uikit",
|
|
3
|
-
"version": "37.0.
|
|
3
|
+
"version": "37.0.2",
|
|
4
4
|
"description": "Documentation content for Uikit packages published at docs.st.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "d30a9eb850b4bdb98b6af7cc06fade1359fcc943"
|
|
20
20
|
}
|