@triplit/react 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{useEffect as y,useState as n}from"react";var m=e=>`http://localhost:3000/queryTriples?live=true&query=${encodeURIComponent(JSON.stringify(e))}`;function d(e,t){let[s,l]=n(void 0),[o,r]=n(!1),{selectStatements:c,whereStatements:i}=t,u=m({collection:t.collectionName,select:c,where:i,clientId:e.clientId});return y(()=>{r(!0);let a=e.subscribe(t,f=>{r(!1),l(f)});return()=>{a()}},[u]),{fetchingLocal:o,results:s,error:null}}export{d as useQuery};
1
+ import{useEffect as y,useState as u}from"react";function d(e,s){let[i,n]=u(void 0),[l,t]=u(!1),r=s.build(),o=JSON.stringify(r);return y(()=>{t(!0);let f=e.subscribe(r,c=>{t(!1),n(c)});return()=>{f()}},[o,e]),{fetchingLocal:l,results:i,error:null}}export{d as useQuery};
@@ -1,5 +1,5 @@
1
- import { QueryResults, TriplitClient, CollectionQuery } from '@triplit/client';
2
- export declare function useQuery<CQ extends CollectionQuery<any>>(client: TriplitClient<any>, collectionQuery: CQ): {
1
+ import { QueryResults, TriplitClient, ClientQuery, toBuilder } from '@triplit/client';
2
+ export declare function useQuery<CQ extends ClientQuery<any>>(client: TriplitClient<any>, query: toBuilder<CQ>): {
3
3
  fetchingLocal: boolean;
4
4
  results: QueryResults<CQ> | undefined;
5
5
  error: null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triplit/react",
3
3
  "packageManager": "yarn@3.4.1",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "type": "module",