Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: getall is being called unnecessarily every time the user accesses the My Collection page #3681

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

Cristhianzl
Copy link
Member

This PR addresses an issue where the /getall endpoint was being called unnecessarily every time a user accessed the 'My Collection' page. This redundant API call could lead to increased load times and unnecessary server strain.

✨ (use-get-folders.ts): Update useGetFoldersQuery to check if types are empty before calling getTypes to avoid unnecessary API calls
♻️ (typesStore.ts): Remove unnecessary useAlertStore setState call to improve code readability and maintainability

…re empty before calling getTypes to avoid unnecessary API calls

♻️ (typesStore.ts): Remove unnecessary useAlertStore setState call to improve code readability and maintainability
@Cristhianzl Cristhianzl self-assigned this Sep 4, 2024
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Sep 4, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-3681.dmtpw4p5recq1.amplifyapp.com

@Cristhianzl Cristhianzl changed the title fix: /getall is being called unnecessarily every time the user accesses the 'My Collection' page fix: getall is being called unnecessarily every time the user accesses the My Collection page Sep 4, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Sep 4, 2024
@lucaseduoli
Copy link
Collaborator

We still have other places that we call getTypes. Can you check them out too?

The `getTypes` function in `typesStore.ts` has been updated to always force a refresh of the types data. This change ensures that the latest data is fetched from the API, avoiding unnecessary API calls.
@Cristhianzl
Copy link
Member Author

getTypes

yes, there's just another place, but Its already true

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 4, 2024
Copy link
Collaborator

@lucaseduoli lucaseduoli left a comment

Choose a reason for hiding this comment

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

LGTM!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 4, 2024
@Cristhianzl Cristhianzl enabled auto-merge (squash) September 4, 2024 16:42
@Cristhianzl Cristhianzl merged commit a670a7c into main Sep 4, 2024
21 of 28 checks passed
@Cristhianzl Cristhianzl deleted the cz/fix-getallLoad branch September 4, 2024 16:48
diogocabral pushed a commit to headlinevc/langflow that referenced this pull request Nov 26, 2024
…s the My Collection page (langflow-ai#3681)

* ✨ (use-get-folders.ts): Update useGetFoldersQuery to check if types are empty before calling getTypes to avoid unnecessary API calls
♻️ (typesStore.ts): Remove unnecessary useAlertStore setState call to improve code readability and maintainability

* feat: Update getTypes function to always force refresh

The `getTypes` function in `typesStore.ts` has been updated to always force a refresh of the types data. This change ensures that the latest data is fetched from the API, avoiding unnecessary API calls.

* Changed types check in other pages

---------

Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants