Skip to content

Commit

Permalink
Fix issue causing store subscriptions to clear (HoudiniGraphql#572)
Browse files Browse the repository at this point in the history
* don't remove the lastVariable tracker

* added changeset

* remove changeset import

* fix store import

* adde changeset

* update test
  • Loading branch information
AlecAivazis authored and endigma committed Nov 10, 2024
1 parent a7a8371 commit 00fd6c4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-ladybugs-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini': patch
---

Fix error causing subscriptions to be removed
5 changes: 5 additions & 0 deletions .changeset/tame-peaches-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini': patch
---

fix bug when importing store classes
8 changes: 5 additions & 3 deletions integration/src/routes/stores/ssr-[userId]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { load_User } from '$houdini';
import { UserStore } from '$houdini';
import { routes } from '$lib/utils/routes';
import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
Expand All @@ -8,9 +8,11 @@ export const load: PageLoad = async (event) => {
throw redirect(307, routes.Home);
}

const variables = { id: event.params.userId, tmp: false };
// instantiate a store using the class so we can see it work somewhere
const User = new UserStore();
await User.fetch({ event, variables: { id: event.params.userId, tmp: false } });

return {
...(await load_User({ event, variables }))
User
};
};
2 changes: 0 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import fs from 'node:fs'
import typescript from 'rollup-plugin-typescript2'

import changesetConfig from './.changeset/config.json'
import packgeJSON from './package.json'

// grab the environment variables
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/stores/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ If this is leftovers from old versions of houdini, you can safely remove this \`
cache.unsubscribe(this.subscriptionSpec, this.lastVariables || {})
}

// clear the variable counter
this.lastVariables = null
// clear the active subscription
this.subscriptionSpec = null
}

Expand Down

0 comments on commit 00fd6c4

Please sign in to comment.