Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

warnOnce.md

45 lines742 Bytes

1---
2id: warnOnce
3title: warnOnce
4---
5​
6```ts
7function warnOnce(key, message): void;
8```
9​
10Defined in: [packages/db/src/utils.ts:410](https://github.com/TanStack/db/blob/main/packages/db/src/utils.ts#L410)
11​
12**`Internal`**
13​
14Log a warning message only once per unique key.
15Subsequent calls with the same key will be silently ignored.
16​
17 Used by first-party collection adapters.
18​
19## Parameters
20​
21### key
22​
23`string`
24​
25Unique identifier for this warning
26​
27### message
28​
29`string`
30​
31The warning message to display
32​
33## Returns
34​
35`void`
36​
37## Example
38​
39```typescript
40// First call logs the warning
41warnOnce('deprecated-api', 'This API is deprecated')
42​
43// Subsequent calls with same key are ignored
44warnOnce('deprecated-api', 'This API is deprecated') // silent
45```