@powersync/react 0.0.0-dev-20240729071401 → 0.0.0-dev-20240903063630

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.
Files changed (2) hide show
  1. package/README.md +35 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -81,3 +81,38 @@ export const TodoListDisplay = () => {
81
81
  </View>
82
82
  }
83
83
  ```
84
+
85
+ #### Query Loading
86
+
87
+ The response from `useQuery` includes the `isLoading` and `isFetching` properties, which indicate the current state of data retrieval. This can be used to show loading spinners or conditional widgets.
88
+
89
+ ```JSX
90
+ // TodoListDisplay.jsx
91
+ import { useQuery } from "@powersync/react";
92
+
93
+ export const TodoListsDisplayDemo = () => {
94
+ const { data: todoLists, isLoading, isFetching } = useQuery('SELECT * FROM lists');
95
+ return (
96
+ <div>
97
+ <h1>Todo Lists {isFetching ? '⟳' : ''}</h1>
98
+ <div
99
+ style={{
100
+ opacity: isLoading ? 1 : 0,
101
+ transition: 'opacity 0.5s ease-in-out'
102
+ }}>
103
+ Loading todo lists...
104
+ </div>
105
+ <ul
106
+ style={{
107
+ opacity: isLoading ? 0 : 1,
108
+ transition: 'opacity 1s ease-in-out'
109
+ }}>
110
+ {todoLists.map(() => (
111
+ <li key={l.id}>{JSON.stringify(l)}</li>
112
+ ))}
113
+ </ul>
114
+ </div>
115
+ );
116
+ };
117
+
118
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/react",
3
- "version": "0.0.0-dev-20240729071401",
3
+ "version": "0.0.0-dev-20240903063630",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -23,7 +23,7 @@
23
23
  "homepage": "https://docs.powersync.com",
24
24
  "peerDependencies": {
25
25
  "react": "*",
26
- "@powersync/common": "0.0.0-dev-20240729071401"
26
+ "@powersync/common": "0.0.0-dev-20240903063630"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@testing-library/react": "^15.0.2",