@tanstack/query-devtools 5.58.0 → 5.59.20

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.
@@ -1,4 +1,4 @@
1
- import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, Devtools } from '../chunk/DNUYL6JI.js';
1
+ import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, Devtools } from '../chunk/QULEXNPG.js';
2
2
  import { getPreferredColorScheme, createMemo, createComponent } from '../chunk/T4EIIERB.js';
3
3
 
4
4
  // src/DevtoolsComponent.tsx
@@ -1,4 +1,4 @@
1
- import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, Devtools } from '../chunk/VREWMQAW.js';
1
+ import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, Devtools } from '../chunk/STCWXWCR.js';
2
2
  import { getPreferredColorScheme, createMemo, createComponent } from '../chunk/BLREPECS.js';
3
3
 
4
4
  // src/DevtoolsComponent.tsx
@@ -1,4 +1,4 @@
1
- import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, ParentPanel, ContentView } from '../chunk/DNUYL6JI.js';
1
+ import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, ParentPanel, ContentView } from '../chunk/QULEXNPG.js';
2
2
  import { getPreferredColorScheme, createMemo, createComponent } from '../chunk/T4EIIERB.js';
3
3
 
4
4
  // src/DevtoolsPanelComponent.tsx
@@ -1,4 +1,4 @@
1
- import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, ParentPanel, ContentView } from '../chunk/VREWMQAW.js';
1
+ import { createLocalStorage, THEME_PREFERENCE, QueryDevtoolsContext, PiPProvider, ThemeContext, ParentPanel, ContentView } from '../chunk/STCWXWCR.js';
2
2
  import { getPreferredColorScheme, createMemo, createComponent } from '../chunk/BLREPECS.js';
3
3
 
4
4
  // src/DevtoolsPanelComponent.tsx
@@ -10859,7 +10859,7 @@ var QueryDetails = () => {
10859
10859
  const restoreQueryAfterLoadingOrError = () => {
10860
10860
  const activeQueryVal = activeQuery();
10861
10861
  const previousState = activeQueryVal.state;
10862
- const previousOptions = activeQueryVal.state.fetchMeta.__previousQueryOptions;
10862
+ const previousOptions = activeQueryVal.state.fetchMeta ? activeQueryVal.state.fetchMeta.__previousQueryOptions : null;
10863
10863
  activeQueryVal.cancel({
10864
10864
  silent: true
10865
10865
  });
@@ -10868,7 +10868,9 @@ var QueryDetails = () => {
10868
10868
  fetchStatus: "idle",
10869
10869
  fetchMeta: null
10870
10870
  });
10871
- activeQueryVal.fetch(previousOptions);
10871
+ if (previousOptions) {
10872
+ activeQueryVal.fetch(previousOptions);
10873
+ }
10872
10874
  };
10873
10875
  createEffect(() => {
10874
10876
  if (statusLabel() !== "fetching") {
@@ -10858,7 +10858,7 @@ var QueryDetails = () => {
10858
10858
  const restoreQueryAfterLoadingOrError = () => {
10859
10859
  const activeQueryVal = activeQuery();
10860
10860
  const previousState = activeQueryVal.state;
10861
- const previousOptions = activeQueryVal.state.fetchMeta.__previousQueryOptions;
10861
+ const previousOptions = activeQueryVal.state.fetchMeta ? activeQueryVal.state.fetchMeta.__previousQueryOptions : null;
10862
10862
  activeQueryVal.cancel({
10863
10863
  silent: true
10864
10864
  });
@@ -10867,7 +10867,9 @@ var QueryDetails = () => {
10867
10867
  fetchStatus: "idle",
10868
10868
  fetchMeta: null
10869
10869
  });
10870
- activeQueryVal.fetch(previousOptions);
10870
+ if (previousOptions) {
10871
+ activeQueryVal.fetch(previousOptions);
10872
+ }
10871
10873
  };
10872
10874
  createEffect(() => {
10873
10875
  if (statusLabel() !== "fetching") {
package/build/dev.cjs CHANGED
@@ -14359,7 +14359,7 @@ var init_Devtools = __esm({
14359
14359
  const restoreQueryAfterLoadingOrError = () => {
14360
14360
  const activeQueryVal = activeQuery();
14361
14361
  const previousState = activeQueryVal.state;
14362
- const previousOptions = activeQueryVal.state.fetchMeta.__previousQueryOptions;
14362
+ const previousOptions = activeQueryVal.state.fetchMeta ? activeQueryVal.state.fetchMeta.__previousQueryOptions : null;
14363
14363
  activeQueryVal.cancel({
14364
14364
  silent: true
14365
14365
  });
@@ -14368,7 +14368,9 @@ var init_Devtools = __esm({
14368
14368
  fetchStatus: "idle",
14369
14369
  fetchMeta: null
14370
14370
  });
14371
- activeQueryVal.fetch(previousOptions);
14371
+ if (previousOptions) {
14372
+ activeQueryVal.fetch(previousOptions);
14373
+ }
14372
14374
  };
14373
14375
  createEffect(() => {
14374
14376
  if (statusLabel() !== "fetching") {
package/build/dev.js CHANGED
@@ -69,7 +69,7 @@ var TanstackQueryDevtools = class {
69
69
  if (this.#Component) {
70
70
  Devtools = this.#Component;
71
71
  } else {
72
- Devtools = lazy(() => import('./DevtoolsComponent/H3J5RHJ6.js'));
72
+ Devtools = lazy(() => import('./DevtoolsComponent/ACWU3NT2.js'));
73
73
  this.#Component = Devtools;
74
74
  }
75
75
  setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
@@ -192,7 +192,7 @@ var TanstackQueryDevtoolsPanel = class {
192
192
  if (this.#Component) {
193
193
  Devtools = this.#Component;
194
194
  } else {
195
- Devtools = lazy(() => import('./DevtoolsPanelComponent/XV5R7GGF.js'));
195
+ Devtools = lazy(() => import('./DevtoolsPanelComponent/7QLFAFLW.js'));
196
196
  this.#Component = Devtools;
197
197
  }
198
198
  setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
package/build/index.cjs CHANGED
@@ -14357,7 +14357,7 @@ var init_Devtools = __esm({
14357
14357
  const restoreQueryAfterLoadingOrError = () => {
14358
14358
  const activeQueryVal = activeQuery();
14359
14359
  const previousState = activeQueryVal.state;
14360
- const previousOptions = activeQueryVal.state.fetchMeta.__previousQueryOptions;
14360
+ const previousOptions = activeQueryVal.state.fetchMeta ? activeQueryVal.state.fetchMeta.__previousQueryOptions : null;
14361
14361
  activeQueryVal.cancel({
14362
14362
  silent: true
14363
14363
  });
@@ -14366,7 +14366,9 @@ var init_Devtools = __esm({
14366
14366
  fetchStatus: "idle",
14367
14367
  fetchMeta: null
14368
14368
  });
14369
- activeQueryVal.fetch(previousOptions);
14369
+ if (previousOptions) {
14370
+ activeQueryVal.fetch(previousOptions);
14371
+ }
14370
14372
  };
14371
14373
  createEffect(() => {
14372
14374
  if (statusLabel() !== "fetching") {
package/build/index.js CHANGED
@@ -69,7 +69,7 @@ var TanstackQueryDevtools = class {
69
69
  if (this.#Component) {
70
70
  Devtools = this.#Component;
71
71
  } else {
72
- Devtools = lazy(() => import('./DevtoolsComponent/COOQDZLH.js'));
72
+ Devtools = lazy(() => import('./DevtoolsComponent/BMGNQTAT.js'));
73
73
  this.#Component = Devtools;
74
74
  }
75
75
  setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
@@ -192,7 +192,7 @@ var TanstackQueryDevtoolsPanel = class {
192
192
  if (this.#Component) {
193
193
  Devtools = this.#Component;
194
194
  } else {
195
- Devtools = lazy(() => import('./DevtoolsPanelComponent/MU7WGUJF.js'));
195
+ Devtools = lazy(() => import('./DevtoolsPanelComponent/UODQIBEW.js'));
196
196
  this.#Component = Devtools;
197
197
  }
198
198
  setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-devtools",
3
- "version": "5.58.0",
3
+ "version": "5.59.20",
4
4
  "description": "Developer tools to interact with and visualize the TanStack Query cache",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -39,7 +39,8 @@
39
39
  },
40
40
  "files": [
41
41
  "build",
42
- "src"
42
+ "src",
43
+ "!src/__tests__"
43
44
  ],
44
45
  "devDependencies": {
45
46
  "@kobalte/core": "^0.13.4",
@@ -54,7 +55,7 @@
54
55
  "superjson": "^2.2.1",
55
56
  "tsup-preset-solid": "^2.2.0",
56
57
  "vite-plugin-solid": "^2.10.2",
57
- "@tanstack/query-core": "5.56.2"
58
+ "@tanstack/query-core": "5.59.20"
58
59
  },
59
60
  "scripts": {}
60
61
  }
package/src/Devtools.tsx CHANGED
@@ -1789,15 +1789,20 @@ const QueryDetails = () => {
1789
1789
  const restoreQueryAfterLoadingOrError = () => {
1790
1790
  const activeQueryVal = activeQuery()!
1791
1791
  const previousState = activeQueryVal.state
1792
- const previousOptions = (activeQueryVal.state.fetchMeta as any)
1793
- .__previousQueryOptions
1792
+ const previousOptions = activeQueryVal.state.fetchMeta
1793
+ ? (activeQueryVal.state.fetchMeta as any).__previousQueryOptions
1794
+ : null
1795
+
1794
1796
  activeQueryVal.cancel({ silent: true })
1795
1797
  activeQueryVal.setState({
1796
1798
  ...previousState,
1797
1799
  fetchStatus: 'idle',
1798
1800
  fetchMeta: null,
1799
1801
  })
1800
- activeQueryVal.fetch(previousOptions)
1802
+
1803
+ if (previousOptions) {
1804
+ activeQueryVal.fetch(previousOptions)
1805
+ }
1801
1806
  }
1802
1807
 
1803
1808
  createEffect(() => {
@@ -1,7 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
-
3
- describe('ReactQueryDevtools', () => {
4
- it('should be able to open and close devtools', async () => {
5
- expect(1).toBe(1)
6
- })
7
- })
@@ -1,732 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { deleteNestedDataByPath, updateNestedDataByPath } from '../utils'
3
-
4
- describe('Utils tests', () => {
5
- describe('updatedNestedDataByPath', () => {
6
- describe('array', () => {
7
- it('should update data correctly', async () => {
8
- const oldData = ['one', 'two', 'three']
9
-
10
- const newData = updateNestedDataByPath(oldData, ['1'], 'new')
11
-
12
- expect(newData).not.toBe(oldData) // should not be the same reference
13
-
14
- expect(oldData).toMatchInlineSnapshot(`
15
- [
16
- "one",
17
- "two",
18
- "three",
19
- ]
20
- `)
21
- expect(newData).toMatchInlineSnapshot(`
22
- [
23
- "one",
24
- "new",
25
- "three",
26
- ]
27
- `)
28
- })
29
- })
30
-
31
- describe('object', () => {
32
- it('should update data correctly', async () => {
33
- const oldData = { title: 'Hello world', id: 1, createdAt: '2021-01-01' }
34
-
35
- const newData = updateNestedDataByPath(
36
- oldData,
37
- ['title'],
38
- 'Brave new world',
39
- )
40
-
41
- expect(newData).not.toBe(oldData) // should not be the same reference
42
-
43
- expect(oldData).toMatchInlineSnapshot(`
44
- {
45
- "createdAt": "2021-01-01",
46
- "id": 1,
47
- "title": "Hello world",
48
- }
49
- `)
50
- expect(newData).toMatchInlineSnapshot(`
51
- {
52
- "createdAt": "2021-01-01",
53
- "id": 1,
54
- "title": "Brave new world",
55
- }
56
- `)
57
- })
58
- })
59
-
60
- describe('set', () => {
61
- it('should update data correctly', async () => {
62
- const oldData = new Set([123, 321, 'hello', 'world'])
63
-
64
- const newData = updateNestedDataByPath(oldData, ['2'], 'hi')
65
-
66
- expect(newData).not.toBe(oldData) // should not be the same reference
67
-
68
- expect(oldData).toMatchInlineSnapshot(`
69
- Set {
70
- 123,
71
- 321,
72
- "hello",
73
- "world",
74
- }
75
- `)
76
- expect(newData).toMatchInlineSnapshot(`
77
- Set {
78
- 123,
79
- 321,
80
- "hi",
81
- "world",
82
- }
83
- `)
84
- })
85
- })
86
-
87
- describe('map', () => {
88
- it('should update data correctly', async () => {
89
- const oldData = new Map([
90
- ['en', 'hello'],
91
- ['fr', 'bonjour'],
92
- ])
93
-
94
- /* eslint-disable cspell/spellchecker */
95
- const newData = updateNestedDataByPath(oldData, ['fr'], 'salut')
96
-
97
- expect(newData).not.toBe(oldData) // should not be the same reference
98
-
99
- expect(oldData).toMatchInlineSnapshot(`
100
- Map {
101
- "en" => "hello",
102
- "fr" => "bonjour",
103
- }
104
- `)
105
- expect(newData).toMatchInlineSnapshot(`
106
- Map {
107
- "en" => "hello",
108
- "fr" => "salut",
109
- }
110
- `)
111
- })
112
- /* eslint-enable */
113
- })
114
-
115
- describe('nested data', () => {
116
- it('should update data correctly', async () => {
117
- /* eslint-disable cspell/spellchecker */
118
- const oldData = new Map([
119
- [
120
- 'pumpkin-pie',
121
- {
122
- id: 1,
123
- title: 'Pumpkin pie',
124
- ingredients: new Set(['pumpkin', 'sugar', 'spices']),
125
- steps: ['mix', 'bake', 'eat'],
126
- translations: new Map([
127
- ['en', 'Pumpkin pie'],
128
- ['fr', 'Tarte à la citrouille'],
129
- ]),
130
- },
131
- ],
132
- [
133
- 'spaghetti-bolonese',
134
- {
135
- id: 2,
136
- title: 'Spaghetti bolonese',
137
- ingredients: new Set([
138
- 'spaghetti',
139
- 'tomato sauce',
140
- 'minced meat',
141
- ]),
142
- steps: ['cook', 'eat'],
143
- translations: new Map([
144
- ['en', 'Spaghetti bolonese'],
145
- ['fr', 'Spaghetti bolonaise'],
146
- ]),
147
- },
148
- ],
149
- ])
150
-
151
- const updatedObject = updateNestedDataByPath(
152
- oldData,
153
- ['pumpkin-pie', 'title'],
154
- 'Pumpkin pie with whipped cream',
155
- )
156
-
157
- const updatedArray = updateNestedDataByPath(
158
- oldData,
159
- ['spaghetti-bolonese', 'steps', '0'],
160
- 'prepare',
161
- )
162
-
163
- const updatedSet = updateNestedDataByPath(
164
- oldData,
165
- ['pumpkin-pie', 'ingredients', '1'],
166
- 'honey',
167
- )
168
-
169
- const updatedMap = updateNestedDataByPath(
170
- oldData,
171
- ['pumpkin-pie', 'translations', 'en'],
172
- 'Best pie ever',
173
- )
174
-
175
- expect(oldData).toMatchInlineSnapshot(`
176
- Map {
177
- "pumpkin-pie" => {
178
- "id": 1,
179
- "ingredients": Set {
180
- "pumpkin",
181
- "sugar",
182
- "spices",
183
- },
184
- "steps": [
185
- "mix",
186
- "bake",
187
- "eat",
188
- ],
189
- "title": "Pumpkin pie",
190
- "translations": Map {
191
- "en" => "Pumpkin pie",
192
- "fr" => "Tarte à la citrouille",
193
- },
194
- },
195
- "spaghetti-bolonese" => {
196
- "id": 2,
197
- "ingredients": Set {
198
- "spaghetti",
199
- "tomato sauce",
200
- "minced meat",
201
- },
202
- "steps": [
203
- "cook",
204
- "eat",
205
- ],
206
- "title": "Spaghetti bolonese",
207
- "translations": Map {
208
- "en" => "Spaghetti bolonese",
209
- "fr" => "Spaghetti bolonaise",
210
- },
211
- },
212
- }
213
- `)
214
-
215
- expect(updatedObject).toMatchInlineSnapshot(`
216
- Map {
217
- "pumpkin-pie" => {
218
- "id": 1,
219
- "ingredients": Set {
220
- "pumpkin",
221
- "sugar",
222
- "spices",
223
- },
224
- "steps": [
225
- "mix",
226
- "bake",
227
- "eat",
228
- ],
229
- "title": "Pumpkin pie with whipped cream",
230
- "translations": Map {
231
- "en" => "Pumpkin pie",
232
- "fr" => "Tarte à la citrouille",
233
- },
234
- },
235
- "spaghetti-bolonese" => {
236
- "id": 2,
237
- "ingredients": Set {
238
- "spaghetti",
239
- "tomato sauce",
240
- "minced meat",
241
- },
242
- "steps": [
243
- "cook",
244
- "eat",
245
- ],
246
- "title": "Spaghetti bolonese",
247
- "translations": Map {
248
- "en" => "Spaghetti bolonese",
249
- "fr" => "Spaghetti bolonaise",
250
- },
251
- },
252
- }
253
- `)
254
-
255
- expect(updatedArray).toMatchInlineSnapshot(`
256
- Map {
257
- "pumpkin-pie" => {
258
- "id": 1,
259
- "ingredients": Set {
260
- "pumpkin",
261
- "sugar",
262
- "spices",
263
- },
264
- "steps": [
265
- "mix",
266
- "bake",
267
- "eat",
268
- ],
269
- "title": "Pumpkin pie",
270
- "translations": Map {
271
- "en" => "Pumpkin pie",
272
- "fr" => "Tarte à la citrouille",
273
- },
274
- },
275
- "spaghetti-bolonese" => {
276
- "id": 2,
277
- "ingredients": Set {
278
- "spaghetti",
279
- "tomato sauce",
280
- "minced meat",
281
- },
282
- "steps": [
283
- "prepare",
284
- "eat",
285
- ],
286
- "title": "Spaghetti bolonese",
287
- "translations": Map {
288
- "en" => "Spaghetti bolonese",
289
- "fr" => "Spaghetti bolonaise",
290
- },
291
- },
292
- }
293
- `)
294
-
295
- expect(updatedSet).toMatchInlineSnapshot(`
296
- Map {
297
- "pumpkin-pie" => {
298
- "id": 1,
299
- "ingredients": Set {
300
- "pumpkin",
301
- "honey",
302
- "spices",
303
- },
304
- "steps": [
305
- "mix",
306
- "bake",
307
- "eat",
308
- ],
309
- "title": "Pumpkin pie",
310
- "translations": Map {
311
- "en" => "Pumpkin pie",
312
- "fr" => "Tarte à la citrouille",
313
- },
314
- },
315
- "spaghetti-bolonese" => {
316
- "id": 2,
317
- "ingredients": Set {
318
- "spaghetti",
319
- "tomato sauce",
320
- "minced meat",
321
- },
322
- "steps": [
323
- "cook",
324
- "eat",
325
- ],
326
- "title": "Spaghetti bolonese",
327
- "translations": Map {
328
- "en" => "Spaghetti bolonese",
329
- "fr" => "Spaghetti bolonaise",
330
- },
331
- },
332
- }
333
- `)
334
-
335
- expect(updatedMap).toMatchInlineSnapshot(`
336
- Map {
337
- "pumpkin-pie" => {
338
- "id": 1,
339
- "ingredients": Set {
340
- "pumpkin",
341
- "sugar",
342
- "spices",
343
- },
344
- "steps": [
345
- "mix",
346
- "bake",
347
- "eat",
348
- ],
349
- "title": "Pumpkin pie",
350
- "translations": Map {
351
- "en" => "Best pie ever",
352
- "fr" => "Tarte à la citrouille",
353
- },
354
- },
355
- "spaghetti-bolonese" => {
356
- "id": 2,
357
- "ingredients": Set {
358
- "spaghetti",
359
- "tomato sauce",
360
- "minced meat",
361
- },
362
- "steps": [
363
- "cook",
364
- "eat",
365
- ],
366
- "title": "Spaghetti bolonese",
367
- "translations": Map {
368
- "en" => "Spaghetti bolonese",
369
- "fr" => "Spaghetti bolonaise",
370
- },
371
- },
372
- }
373
- `)
374
- /* eslint-enable */
375
- })
376
- })
377
- })
378
-
379
- describe('deleteNestedDataByPath', () => {
380
- it('should delete item from array correctly', async () => {
381
- const oldData = ['one', 'two', 'three']
382
-
383
- const newData = deleteNestedDataByPath(oldData, ['1'])
384
-
385
- expect(newData).not.toBe(oldData) // should not be the same reference
386
-
387
- expect(oldData).toMatchInlineSnapshot(`
388
- [
389
- "one",
390
- "two",
391
- "three",
392
- ]
393
- `)
394
- expect(newData).toMatchInlineSnapshot(`
395
- [
396
- "one",
397
- "three",
398
- ]
399
- `)
400
- })
401
-
402
- it('should delete item from object correctly', async () => {
403
- const oldData = { title: 'Hello world', id: 1, createdAt: '2021-01-01' }
404
-
405
- const newData = deleteNestedDataByPath(oldData, ['createdAt'])
406
-
407
- expect(newData).not.toBe(oldData) // should not be the same reference
408
-
409
- expect(oldData).toMatchInlineSnapshot(`
410
- {
411
- "createdAt": "2021-01-01",
412
- "id": 1,
413
- "title": "Hello world",
414
- }
415
- `)
416
- expect(newData).toMatchInlineSnapshot(`
417
- {
418
- "id": 1,
419
- "title": "Hello world",
420
- }
421
- `)
422
- })
423
-
424
- it('should delete item from set', () => {
425
- const oldData = new Set([123, 321, false, true])
426
-
427
- const newData = deleteNestedDataByPath(oldData, ['1'])
428
-
429
- expect(newData).not.toBe(oldData) // should not be the same reference
430
-
431
- expect(oldData).toMatchInlineSnapshot(`
432
- Set {
433
- 123,
434
- 321,
435
- false,
436
- true,
437
- }
438
- `)
439
- expect(newData).toMatchInlineSnapshot(`
440
- Set {
441
- 123,
442
- false,
443
- true,
444
- }
445
- `)
446
- })
447
-
448
- it('should delete item from map', () => {
449
- const oldData = new Map([
450
- ['123', 'one'],
451
- ['hello', 'two'],
452
- ['world', 'three'],
453
- ])
454
-
455
- const newData = deleteNestedDataByPath(oldData, ['world'])
456
-
457
- expect(newData).not.toBe(oldData) // should not be the same reference
458
-
459
- expect(oldData).toMatchInlineSnapshot(`
460
- Map {
461
- "123" => "one",
462
- "hello" => "two",
463
- "world" => "three",
464
- }
465
- `)
466
- expect(newData).toMatchInlineSnapshot(`
467
- Map {
468
- "123" => "one",
469
- "hello" => "two",
470
- }
471
- `)
472
- })
473
-
474
- describe('nested data', () => {
475
- it('should delete nested items correctly', async () => {
476
- /* eslint-disable cspell/spellchecker */
477
- const oldData = new Map([
478
- [
479
- 'pumpkin-pie',
480
- {
481
- id: 1,
482
- title: 'Pumpkin pie',
483
- ingredients: new Set(['pumpkin', 'sugar', 'spices']),
484
- steps: ['mix', 'bake', 'eat'],
485
- translations: new Map([
486
- ['en', 'Pumpkin pie'],
487
- ['fr', 'Tarte à la citrouille'],
488
- ]),
489
- },
490
- ],
491
- [
492
- 'spaghetti-bolonese',
493
- {
494
- id: 2,
495
- title: 'Spaghetti bolonese',
496
- ingredients: new Set([
497
- 'spaghetti',
498
- 'tomato sauce',
499
- 'minced meat',
500
- ]),
501
- steps: ['cook', 'eat'],
502
- translations: new Map([
503
- ['en', 'Spaghetti bolonese'],
504
- ['fr', 'Spaghetti bolonaise'],
505
- ]),
506
- },
507
- ],
508
- ])
509
-
510
- const deletedFromSet = deleteNestedDataByPath(oldData, [
511
- 'spaghetti-bolonese',
512
- 'ingredients',
513
- '0',
514
- ])
515
-
516
- const deletedFromArray = deleteNestedDataByPath(oldData, [
517
- 'pumpkin-pie',
518
- 'steps',
519
- '1',
520
- ])
521
-
522
- const deletedFromObject = deleteNestedDataByPath(oldData, [
523
- 'pumpkin-pie',
524
- 'title',
525
- ])
526
-
527
- const deletedFromMap = deleteNestedDataByPath(oldData, [
528
- 'spaghetti-bolonese',
529
- 'translations',
530
- 'fr',
531
- ])
532
-
533
- expect(oldData).toMatchInlineSnapshot(`
534
- Map {
535
- "pumpkin-pie" => {
536
- "id": 1,
537
- "ingredients": Set {
538
- "pumpkin",
539
- "sugar",
540
- "spices",
541
- },
542
- "steps": [
543
- "mix",
544
- "bake",
545
- "eat",
546
- ],
547
- "title": "Pumpkin pie",
548
- "translations": Map {
549
- "en" => "Pumpkin pie",
550
- "fr" => "Tarte à la citrouille",
551
- },
552
- },
553
- "spaghetti-bolonese" => {
554
- "id": 2,
555
- "ingredients": Set {
556
- "spaghetti",
557
- "tomato sauce",
558
- "minced meat",
559
- },
560
- "steps": [
561
- "cook",
562
- "eat",
563
- ],
564
- "title": "Spaghetti bolonese",
565
- "translations": Map {
566
- "en" => "Spaghetti bolonese",
567
- "fr" => "Spaghetti bolonaise",
568
- },
569
- },
570
- }
571
- `)
572
-
573
- expect(deletedFromSet).toMatchInlineSnapshot(`
574
- Map {
575
- "pumpkin-pie" => {
576
- "id": 1,
577
- "ingredients": Set {
578
- "pumpkin",
579
- "sugar",
580
- "spices",
581
- },
582
- "steps": [
583
- "mix",
584
- "bake",
585
- "eat",
586
- ],
587
- "title": "Pumpkin pie",
588
- "translations": Map {
589
- "en" => "Pumpkin pie",
590
- "fr" => "Tarte à la citrouille",
591
- },
592
- },
593
- "spaghetti-bolonese" => {
594
- "id": 2,
595
- "ingredients": Set {
596
- "tomato sauce",
597
- "minced meat",
598
- },
599
- "steps": [
600
- "cook",
601
- "eat",
602
- ],
603
- "title": "Spaghetti bolonese",
604
- "translations": Map {
605
- "en" => "Spaghetti bolonese",
606
- "fr" => "Spaghetti bolonaise",
607
- },
608
- },
609
- }
610
- `)
611
-
612
- expect(deletedFromArray).toMatchInlineSnapshot(`
613
- Map {
614
- "pumpkin-pie" => {
615
- "id": 1,
616
- "ingredients": Set {
617
- "pumpkin",
618
- "sugar",
619
- "spices",
620
- },
621
- "steps": [
622
- "mix",
623
- "eat",
624
- ],
625
- "title": "Pumpkin pie",
626
- "translations": Map {
627
- "en" => "Pumpkin pie",
628
- "fr" => "Tarte à la citrouille",
629
- },
630
- },
631
- "spaghetti-bolonese" => {
632
- "id": 2,
633
- "ingredients": Set {
634
- "spaghetti",
635
- "tomato sauce",
636
- "minced meat",
637
- },
638
- "steps": [
639
- "cook",
640
- "eat",
641
- ],
642
- "title": "Spaghetti bolonese",
643
- "translations": Map {
644
- "en" => "Spaghetti bolonese",
645
- "fr" => "Spaghetti bolonaise",
646
- },
647
- },
648
- }
649
- `)
650
-
651
- expect(deletedFromObject).toMatchInlineSnapshot(`
652
- Map {
653
- "pumpkin-pie" => {
654
- "id": 1,
655
- "ingredients": Set {
656
- "pumpkin",
657
- "sugar",
658
- "spices",
659
- },
660
- "steps": [
661
- "mix",
662
- "bake",
663
- "eat",
664
- ],
665
- "translations": Map {
666
- "en" => "Pumpkin pie",
667
- "fr" => "Tarte à la citrouille",
668
- },
669
- },
670
- "spaghetti-bolonese" => {
671
- "id": 2,
672
- "ingredients": Set {
673
- "spaghetti",
674
- "tomato sauce",
675
- "minced meat",
676
- },
677
- "steps": [
678
- "cook",
679
- "eat",
680
- ],
681
- "title": "Spaghetti bolonese",
682
- "translations": Map {
683
- "en" => "Spaghetti bolonese",
684
- "fr" => "Spaghetti bolonaise",
685
- },
686
- },
687
- }
688
- `)
689
-
690
- expect(deletedFromMap).toMatchInlineSnapshot(`
691
- Map {
692
- "pumpkin-pie" => {
693
- "id": 1,
694
- "ingredients": Set {
695
- "pumpkin",
696
- "sugar",
697
- "spices",
698
- },
699
- "steps": [
700
- "mix",
701
- "bake",
702
- "eat",
703
- ],
704
- "title": "Pumpkin pie",
705
- "translations": Map {
706
- "en" => "Pumpkin pie",
707
- "fr" => "Tarte à la citrouille",
708
- },
709
- },
710
- "spaghetti-bolonese" => {
711
- "id": 2,
712
- "ingredients": Set {
713
- "spaghetti",
714
- "tomato sauce",
715
- "minced meat",
716
- },
717
- "steps": [
718
- "cook",
719
- "eat",
720
- ],
721
- "title": "Spaghetti bolonese",
722
- "translations": Map {
723
- "en" => "Spaghetti bolonese",
724
- },
725
- },
726
- }
727
- `)
728
- /* eslint-enable */
729
- })
730
- })
731
- })
732
- })