Skip to content

Commit

Permalink
cleanup after rebasing onto reeact refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgapp committed Jan 5, 2024
1 parent afd2a3e commit 861ca94
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 424 deletions.
8 changes: 4 additions & 4 deletions lib/sqlsync-react/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function useSQLSync(): SQLSync {
const value = useContext(SQLSyncContext);
if (!value) {
throw new Error(
"could not find sqlsync context value; please ensure the component is wrapped in a <SqlSyncProvider>",
"could not find sqlsync context value; please ensure the component is wrapped in a <SqlSyncProvider>"
);
}
return value;
Expand All @@ -43,7 +43,7 @@ export function createDocHooks<M>(docType: DocType<M>): DocHooks<M> {
const sqlsync = useSQLSync();
return useCallback(
(mutation: M) => sqlsync.mutate(docId, docType, mutation),
[sqlsync, docId, docType],
[sqlsync, docId, docType]
);
};

Expand All @@ -55,7 +55,7 @@ export function createDocHooks<M>(docType: DocType<M>): DocHooks<M> {
const sqlsync = useSQLSync();
return useCallback(
(enabled: boolean) => sqlsync.setConnectionEnabled(docId, docType, enabled),
[sqlsync, docId, docType],
[sqlsync, docId, docType]
);
};

Expand All @@ -74,7 +74,7 @@ export type QueryState<R> =
export function useQuery<M, R = Row>(
docType: DocType<M>,
docId: DocId,
rawQuery: ParameterizedQuery | string,
rawQuery: ParameterizedQuery | string
): QueryState<R> {
const sqlsync = useSQLSync();
const [state, setState] = useState<QueryState<R>>({ state: "pending" });
Expand Down
15 changes: 11 additions & 4 deletions lib/sqlsync-solid-js/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { ConnectionStatus, DocId } from "@orbitinghail/sqlsync-worker";
import {
ConnectionStatus,
DocId,
DocType,
ParameterizedQuery,
QuerySubscription,
Row,
SQLSync,
normalizeQuery,
pendingPromise,
} from "@orbitinghail/sqlsync-worker";
import { Accessor, createEffect, createSignal, onCleanup, useContext } from "solid-js";
import { SQLSyncContext } from "./context";
import { ParameterizedQuery, normalizeQuery } from "./sql";
import { DocType, QuerySubscription, Row, SQLSync } from "./sqlsync";
import { pendingPromise } from "./util";

export function useSQLSync(): Accessor<SQLSync> {
const [sqlSync] = useContext(SQLSyncContext);
Expand Down
6 changes: 1 addition & 5 deletions lib/sqlsync-solid-js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { SQLSyncProvider } from "./context";
import { createDocHooks, useConnectionStatus } from "./hooks";
import { sql } from "./sql";
import { DocType, Row } from "./sqlsync";
import { serializeMutationAsJSON } from "./util";

export { SQLSyncProvider, createDocHooks, serializeMutationAsJSON, sql, useConnectionStatus };
export type { DocType, Row };
export { SQLSyncProvider, createDocHooks, useConnectionStatus };

// eof: this file only exports
42 changes: 0 additions & 42 deletions lib/sqlsync-solid-js/src/sql.ts

This file was deleted.

Loading

0 comments on commit 861ca94

Please sign in to comment.