Skip to content

Commit

Permalink
Fix custom pages without network data (#160)
Browse files Browse the repository at this point in the history
* Fix custom pages without network data

* Create itchy-kangaroos-flash.md

* pnpm ci version
  • Loading branch information
PabloSzx authored Jul 15, 2024
1 parent 975cca8 commit b9b13f3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-kangaroos-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@soundxyz/graphql-react-query": patch
---

Fix custom pages without network data
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0

- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4.0.0
with:
version: 7.19.0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 0

- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4.0.0
with:
version: 7.19.0

Expand Down
5 changes: 2 additions & 3 deletions packages/graphql-react-query/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,7 @@ export function GraphQLReactQueryClient<
const { nodes: entityStoreNodesSnapshot } = useProxySnapshot(entityStore);

const orderedList = useMemo<Entity[]>(() => {
if (!data) return [];


const currentListFn = latestListFn.current;
const currentUniq = latestUniq.current;
const currentOrder = latestOrder.current;
Expand Down Expand Up @@ -990,7 +989,7 @@ export function GraphQLReactQueryClient<

const initialValues = customPages ? customPages.reduce(reduceAccumulatedPages, {}) : {};

const values = data.pages.reduce(reduceAccumulatedPages, initialValues);
const values = data?.pages.reduce(reduceAccumulatedPages, initialValues) ?? initialValues;

if (currentOrder) return orderBy(values, currentOrder, stableOrderType);

Expand Down

0 comments on commit b9b13f3

Please sign in to comment.