Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues after merge #179

Merged
merged 2 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions dataconnect-sdk/js/default-connector/esm/index.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const connectorConfig = {
};

export function createMovieRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars } = validateArgs(connectorConfig, dcOrVars, vars, true);
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
return mutationRef(dcInstance, 'CreateMovie', inputVars);
}
Expand All @@ -17,7 +17,7 @@ export function createMovie(dcOrVars, vars) {
}

export function upsertMovieRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars } = validateArgs(connectorConfig, dcOrVars, vars, true);
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
return mutationRef(dcInstance, 'UpsertMovie', inputVars);
}
Expand All @@ -27,7 +27,7 @@ export function upsertMovie(dcOrVars, vars) {
}

export function deleteMovieRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars } = validateArgs(connectorConfig, dcOrVars, vars, true);
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
return mutationRef(dcInstance, 'DeleteMovie', inputVars);
}
Expand All @@ -37,7 +37,7 @@ export function deleteMovie(dcOrVars, vars) {
}

export function addMetaRef(dc) {
const { dc: dcInstance } = validateArgs(connectorConfig, dc, undefined);
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
dcInstance._useGeneratedSdk();
return mutationRef(dcInstance, 'AddMeta');
}
Expand All @@ -47,7 +47,7 @@ export function addMeta(dc) {
}

export function deleteMetaRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars } = validateArgs(connectorConfig, dcOrVars, vars, true);
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
return mutationRef(dcInstance, 'DeleteMeta', inputVars);
}
Expand All @@ -57,7 +57,7 @@ export function deleteMeta(dcOrVars, vars) {
}

export function listMoviesRef(dc) {
const { dc: dcInstance } = validateArgs(connectorConfig, dc, undefined);
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
dcInstance._useGeneratedSdk();
return queryRef(dcInstance, 'ListMovies');
}
Expand All @@ -67,7 +67,7 @@ export function listMovies(dc) {
}

export function getMovieByIdRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars } = validateArgs(connectorConfig, dcOrVars, vars, true);
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
return queryRef(dcInstance, 'GetMovieById', inputVars);
}
Expand All @@ -77,7 +77,7 @@ export function getMovieById(dcOrVars, vars) {
}

export function getMetaRef(dc) {
const { dc: dcInstance } = validateArgs(connectorConfig, dc, undefined);
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
dcInstance._useGeneratedSdk();
return queryRef(dcInstance, 'GetMeta');
}
Expand Down
6 changes: 0 additions & 6 deletions dataconnect-sdk/js/default-connector/index.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ exports.createMovieRef = function createMovieRef(dcOrVars, vars) {
exports.createMovie = function createMovie(dcOrVars, vars) {
return executeMutation(createMovieRef(dcOrVars, vars));
};

exports.upsertMovieRef = function upsertMovieRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
Expand All @@ -24,7 +23,6 @@ exports.upsertMovieRef = function upsertMovieRef(dcOrVars, vars) {
exports.upsertMovie = function upsertMovie(dcOrVars, vars) {
return executeMutation(upsertMovieRef(dcOrVars, vars));
};

exports.deleteMovieRef = function deleteMovieRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
Expand All @@ -33,7 +31,6 @@ exports.deleteMovieRef = function deleteMovieRef(dcOrVars, vars) {
exports.deleteMovie = function deleteMovie(dcOrVars, vars) {
return executeMutation(deleteMovieRef(dcOrVars, vars));
};

exports.addMetaRef = function addMetaRef(dc) {
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
dcInstance._useGeneratedSdk();
Expand All @@ -42,7 +39,6 @@ exports.addMetaRef = function addMetaRef(dc) {
exports.addMeta = function addMeta(dc) {
return executeMutation(addMetaRef(dc));
};

exports.deleteMetaRef = function deleteMetaRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
Expand All @@ -51,7 +47,6 @@ exports.deleteMetaRef = function deleteMetaRef(dcOrVars, vars) {
exports.deleteMeta = function deleteMeta(dcOrVars, vars) {
return executeMutation(deleteMetaRef(dcOrVars, vars));
};

exports.listMoviesRef = function listMoviesRef(dc) {
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
dcInstance._useGeneratedSdk();
Expand All @@ -60,7 +55,6 @@ exports.listMoviesRef = function listMoviesRef(dc) {
exports.listMovies = function listMovies(dc) {
return executeQuery(listMoviesRef(dc));
};

exports.getMovieByIdRef = function getMovieByIdRef(dcOrVars, vars) {
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
dcInstance._useGeneratedSdk();
Expand Down
4 changes: 2 additions & 2 deletions examples/react-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack-query-firebase/react": "link:../../packages/react",
"@dataconnect/default-connector": "link:../../dataconnect-sdk",
"@tanstack-query-firebase/react": "link:../../packages/react/dist",
"@dataconnect/default-connector": "link:../../dataconnect-sdk/js/default-connector",
"firebase": "^11.3.0",
"next": "15.1.0",
"react": "^19.0.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/react-example/src/examples/data-connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function Movies() {
const movies = useDataConnectQuery(listMoviesRef());

const addMovie = useDataConnectMutation(createMovieRef, {
invalidate: [listMoviesRef],
invalidate: [listMoviesRef()],
});

if (movies.isLoading) {
Expand All @@ -39,10 +39,10 @@ export function Movies() {
Add Movie
</button>
<ul>
<li>Fetch Time: {movies.data?.fetchTime}</li>
<li>Source: {movies.data?.source}</li>
<li>Fetch Time: {movies.dataConnectResult?.fetchTime}</li>
<li>Source: {movies.dataConnectResult?.source}</li>
<li>
Query Key: {movies.data?.ref.name} + {movies.data?.ref.variables}
Query Key: {movies.dataConnectResult?.ref.name} + {movies.dataConnectResult?.ref.variables}
</li>
{movies.data!.movies.map((movie) => (
<li key={movie.id}>{movie.title}</li>
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/data-connect/useDataConnectQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import {
} from "firebase/data-connect";
import { useState } from "react";
import type { PartialBy } from "../../utils";
import type { QueryResultRequiredRef, UseDataConnectQuery } from "./types";
import type {
QueryResultRequiredRef,
UseDataConnectQueryResult,
} from "./types";

export type useDataConnectQueryOptions<
TData = object,
Expand All @@ -20,7 +23,7 @@ export function useDataConnectQuery<Data = unknown, Variables = unknown>(
refOrResult: QueryRef<Data, Variables> | QueryResult<Data, Variables>,
options?: useDataConnectQueryOptions<Data, FirebaseError>,
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackReactCore,
): UseDataConnectQuery<Data, Variables> {
): UseDataConnectQueryResult<Data, Variables> {
const [dataConnectResult, setDataConnectResult] = useState<
QueryResultRequiredRef<Data, Variables>
>("ref" in refOrResult ? refOrResult : { ref: refOrResult });
Expand Down
1 change: 1 addition & 0 deletions packages/react/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default defineConfig({
format: ["esm"],
dts: true, // generates .d.ts files
outDir: "dist",
external: ['react'],
esbuildOptions(options, context) {
options.outbase = './src';
},
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.