File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ export const useWatchedSuspenseQuery = <T = any>(
3434 return {
3535 ...result ,
3636 // The result above is readonly, but this API expects a mutable array
37- data : [ ...result . data ]
37+ // We need to keep the same reference also.
38+ data : result . data as T [ ]
3839 } ;
3940} ;
Original file line number Diff line number Diff line change @@ -44,8 +44,9 @@ export const useWatchedQuery = <RowType = unknown>(
4444 const result = useWatchedQuerySubscription ( watchedQuery ) ;
4545 return {
4646 ...result ,
47- // The Watched Query API returns readonly arrays,
47+ // The Watched Query API returns readonly arrays.
48+ // We need to keep the same reference also.
4849 // This allows compatibility with the hook API.
49- data : [ ... result . data ]
50+ data : result . data as RowType [ ]
5051 } ;
5152} ;
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export const useWatchedQuery = <T = any>(
7373 isLoading . value = state . isLoading ;
7474 isFetching . value = state . isFetching ;
7575 // The watched query state is readonly
76- data . value = [ ... state . data ] ;
76+ data . value = state . data as T [ ] ;
7777 if ( state . error ) {
7878 const wrappedError = new Error ( 'PowerSync failed to fetch data: ' + state . error . message ) ;
7979 wrappedError . cause = state . error ;
You can’t perform that action at this time.
0 commit comments