Skip to content

Conversation

@imp-dance
Copy link
Collaborator

@imp-dance imp-dance commented Feb 27, 2023

Fixes #12 (Extending transform only works when at the end of a chain)

The example given in the issue now resolves correctly:

const test = createLoader({
  useQueries: () => ({
    queries: {
      query1: useCreateQuery(async () => "foo" as const),
    }
  }),
}).extend({
  transform: (data) => data.queries.query1.data,
}).extend({
  onLoading: () => <div>Loading...</div>,
})

// Resolves to "foo", which is correct
type Data = Types.InferLoaderData<typeof test>;

This also does not seem to break any of the other types, atleast not the ones present in tests.test.tsx or testComponents.tsx - which covers quite a wide range of variations.

@netlify
Copy link

netlify bot commented Feb 27, 2023

Deploy Preview for rtk-query-loader canceled.

Name Link
🔨 Latest commit ab380bc
🔍 Latest deploy log https://app.netlify.com/sites/rtk-query-loader/deploys/63fe275716dfcc00083ed36f

@imp-dance
Copy link
Collaborator Author

imp-dance commented Feb 27, 2023

Published beta-release 1.0.1-beta.0. Will test changes properly to ensure that this does not break any other types that used to work before. If everything looks good, I'll publish a new release, 1.0.1

@imp-dance imp-dance merged commit 8f77b90 into main Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extending transform only works if it is in the end of the chain

2 participants