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

QueueStrategy.md

93 lines1.9 KB

1---
2id: QueueStrategy
3title: QueueStrategy
4---
5​
6Defined in: [packages/db/src/strategies/types.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L66)
7​
8Queue strategy that processes all executions in order
9FIFO: { addItemsTo: 'back', getItemsFrom: 'front' }
10LIFO: { addItemsTo: 'back', getItemsFrom: 'back' }
11​
12## Extends
13​
14- [`BaseStrategy`](BaseStrategy.md)\<`"queue"`\>
15​
16## Properties
17​
18### \_type
19​
20```ts
21_type: "queue";
22```
23​
24Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8)
25​
26Type discriminator for strategy identification
27​
28#### Inherited from
29​
30[`BaseStrategy`](BaseStrategy.md).[`_type`](BaseStrategy.md#_type)
31​
32***
33​
34### cleanup()
35​
36```ts
37cleanup: () => void;
38```
39​
40Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23)
41​
42Clean up any resources held by the strategy
43Should be called when the strategy is no longer needed
44​
45#### Returns
46​
47`void`
48​
49#### Inherited from
50​
51[`BaseStrategy`](BaseStrategy.md).[`cleanup`](BaseStrategy.md#cleanup)
52​
53***
54​
55### execute()
56​
57```ts
58execute: <T>(fn) => boolean | void | Promise<void>;
59```
60​
61Defined in: [packages/db/src/strategies/types.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L69)
62​
63Explicit false rejects the transaction; void preserves custom strategies.
64​
65#### Type Parameters
66​
67##### T
68​
69`T` *extends* `object` = `Record`\<`string`, `unknown`\>
70​
71#### Parameters
72​
73##### fn
74​
75() => [`Transaction`](Transaction.md)\<`T`\>
76​
77#### Returns
78​
79`boolean` \| `void` \| `Promise`\<`void`\>
80​
81#### Overrides
82​
83[`BaseStrategy`](BaseStrategy.md).[`execute`](BaseStrategy.md#execute)
84​
85***
86​
87### options?
88​
89```ts
90optional options: QueueStrategyOptions;
91```
92​
93Defined in: [packages/db/src/strategies/types.ts:67](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L67)