Skip to content

Commit 4538c69

Browse files
committed
fix initialization of client and tags manager
1 parent 94df330 commit 4538c69

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

examples/vite/vite.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import { defineConfig } from 'vite';
88
const isStackblitz = process.env.SHELL === '/bin/jsh';
99

1010
// https://vitejs.dev/config/
11-
export default defineConfig({
11+
export default defineConfig(({ mode }) => ({
1212
plugins: [TanStackRouterVite({ target: 'react', autoCodeSplitting: true }), react()],
1313
optimizeDeps: { exclude: ['tanstack-query-builder'] },
1414
server: { port: 3100 },
1515
resolve: {
1616
alias: {
1717
src: path.resolve(import.meta.dirname, 'src'),
1818
},
19-
conditions: [...(isStackblitz ? ['stackblitz', 'node'] : ['browser']), 'tanstack-query-builder@dev'],
19+
conditions: [
20+
...(isStackblitz ? ['stackblitz', 'node'] : ['browser']),
21+
...(mode !== 'production' ? ['tanstack-query-builder@dev'] : []),
22+
],
2023
},
2124
test: {
2225
globals: true,
@@ -36,4 +39,4 @@ export default defineConfig({
3639
],
3740
},
3841
},
39-
});
42+
}));

packages/tanstack-query-builder/src/builder/QueryBuilderFrozen.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ export class QueryBuilderFrozen<
8080
> {
8181
constructor(public readonly config: BuilderConfig<TVars, TData, TError, TKey>) {
8282
if (config.bound) bindMethods(this, methodsToBind);
83+
this.client = new QueryBuilderClient(this) as typeof this.client;
84+
this.tags = new QueryBuilderTagsManager(this) as typeof this.tags;
8385
}
8486

85-
readonly client = new QueryBuilderClient(this) as HasClient<TFlags, QueryBuilderClient<TVars, TData, TError, TKey, TTags>>;
86-
readonly tags = new QueryBuilderTagsManager(this) as HasClient<TFlags, QueryBuilderTagsManager<TVars, TData, TError, TKey, TTags>>;
87+
readonly client: HasClient<TFlags, QueryBuilderClient<TVars, TData, TError, TKey, TTags>>;
88+
readonly tags: HasClient<TFlags, QueryBuilderTagsManager<TVars, TData, TError, TKey, TTags>>;
8789

8890
protected mergeConfigs(config: typeof this.config, other: Partial<typeof this.config>): typeof this.config {
8991
return {

0 commit comments

Comments
 (0)