Skip to content

Commit 8d42ef6

Browse files
authored
enhance: useDLE() react native focus handling (#2997)
1 parent 326f5e2 commit 8d42ef6

File tree

10 files changed

+580
-11
lines changed

10 files changed

+580
-11
lines changed

.changeset/three-owls-notice.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@data-client/react": minor
3+
---
4+
5+
useDLE() reactive native focus handling
6+
7+
When using React Navigation, useDLE() will trigger fetches on focus if the data is considered
8+
stale.

docs/core/api/useDLE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ render(<ProfileList />);
8989

9090
:::
9191

92+
:::info React Native
93+
94+
When using React Navigation, useDLE() will trigger fetches on focus if the data is considered
95+
stale.
96+
97+
:::
98+
9299
<ConditionalDependencies hook="useDLE" />
93100

94101
## Types
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`useDLE should dispatch singles 1`] = `
4+
{
5+
"endpoint": [Function],
6+
"meta": {
7+
"args": [
8+
{
9+
"id": 5,
10+
},
11+
],
12+
"key": "GET http://test.com/article-cooler/5",
13+
"nm": false,
14+
"reject": [Function],
15+
"resolve": [Function],
16+
"throttle": true,
17+
},
18+
"payload": [Function],
19+
"type": "rdc/fetch",
20+
}
21+
`;
22+
23+
exports[`useDLE should dispatch with fetch shape defined dataExpiryLength 1`] = `
24+
{
25+
"endpoint": [Function],
26+
"meta": {
27+
"args": [
28+
{
29+
"id": 5,
30+
},
31+
],
32+
"key": "GET http://test.com/article-static/5",
33+
"nm": false,
34+
"reject": [Function],
35+
"resolve": [Function],
36+
"throttle": true,
37+
},
38+
"payload": [Function],
39+
"type": "rdc/fetch",
40+
}
41+
`;
42+
43+
exports[`useDLE should dispatch with fetch shape defined errorExpiryLength 1`] = `
44+
{
45+
"endpoint": [Function],
46+
"meta": {
47+
"args": [
48+
{
49+
"id": 5,
50+
},
51+
],
52+
"key": "GET http://test.com/article-static/5",
53+
"nm": false,
54+
"reject": [Function],
55+
"resolve": [Function],
56+
"throttle": true,
57+
},
58+
"payload": [Function],
59+
"type": "rdc/fetch",
60+
}
61+
`;
62+
63+
exports[`useDLE should dispatch with resource defined dataExpiryLength 1`] = `
64+
{
65+
"endpoint": [Function],
66+
"meta": {
67+
"args": [
68+
{
69+
"id": 5,
70+
},
71+
],
72+
"key": "GET http://test.com/article-static/5",
73+
"nm": false,
74+
"reject": [Function],
75+
"resolve": [Function],
76+
"throttle": true,
77+
},
78+
"payload": [Function],
79+
"type": "rdc/fetch",
80+
}
81+
`;

0 commit comments

Comments
 (0)