Skip to content

feat(network): add query factory library#85

Merged
juanchoperezj merged 10 commits intomasterfrom
feat/query-factory
Dec 20, 2024
Merged

feat(network): add query factory library#85
juanchoperezj merged 10 commits intomasterfrom
feat/query-factory

Conversation

@juanchoperezj
Copy link
Copy Markdown

@juanchoperezj juanchoperezj commented Oct 31, 2024

What does this do?

Introduces a new approach to handle the query keys of the react-query.
We can now centralize and have a standardized way to declare our query keys, and from that place reuse them without worrying about typos.

Also, new things were added:

  • Login endpoint
  • Token usage in interceptors
  • Carts query

Why did you do this?

Previously, we did not have a a consensus or an agreed approach in the community to handle query keys, causing different approaches to appear; using strings only for keys, enums, and others.
Sometimes this causes duplication, typos, or different query keys with the same data.

Who/what does this impact?

Impact the way the query keys are defined.

How did you test this?

Tests updated to match the UI.

@juanchoperezj juanchoperezj self-assigned this Oct 31, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 31, 2024

💯 Test Coverage

Lines Statements Branches Functions
Coverage: 46%
46.64% (264/566) 43.1% (100/232) 33.02% (72/218)

😎 Tests Results

Tests Skipped Failures Errors Time
66 0 💤 0 ❌ 0 🔥 27.353s ⏱️
👀 Tests Details • (46%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files46.6443.133.0246.95 
api010000 
   query-factory.ts01000011–28
api/auth010000 
   use-login.ts01000020–36
api/carts0000 
   query-keys.ts0100003–5
   types.ts0000 
   use-carts.ts000011–34
api/common81.635062.584.78 
   interceptors.ts90.97510090.915
api/posts010000 
   index.ts0000 
   types.ts0000 
   use-add-post.ts01000010–19
   use-post-comments.ts01000016–23
   use-post.ts01000012–17
   use-posts.ts01000012–15
app0000 
   login.tsx01000011–24
app/(app)0000 
   _layout.tsx000015–78
   carts.tsx000010–23
   index.tsx000010–30
app/feed0000 
   [id].tsx00008–60
   add-post.tsx01000012–47
components42.510041.1742.5 
   login-form.tsx10010050100 
components/cart-item0000 
   cart-item.tsx00006–51

@guillermomachado guillermomachado marked this pull request as ready for review November 5, 2024 17:35
@guillermomachado guillermomachado requested a review from a team as a code owner November 5, 2024 17:35
Copy link
Copy Markdown
Collaborator

@fernandatoledo fernandatoledo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us know if you need help with the tests :D

Copy link
Copy Markdown
Collaborator

@fernandatoledo fernandatoledo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces multiple functionalities: new API hooks, types, query keys, and interceptors. For future PRs, it might be better to split into smaller, more focused PRs for easier review and faster feedback cycles.

@juanchoperezj juanchoperezj merged commit eb28cb9 into master Dec 20, 2024
@juanchoperezj juanchoperezj deleted the feat/query-factory branch December 20, 2024 18:40
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.

5 participants