Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fetching data pattern improvement #795

Open
AndrewThien opened this issue Jul 15, 2024 · 1 comment
Open

Fetching data pattern improvement #795

AndrewThien opened this issue Jul 15, 2024 · 1 comment
Milestone

Comments

@AndrewThien
Copy link
Contributor

AndrewThien commented Jul 15, 2024

The logic of API endpoints, which are getting data from the backend (get....), raised some concerns from @blargly :

  • When it fails to get data, the function will return the "full shape" object with all of the params going along with an empty string, 0 or null, or false ... --> This may not be necessary and be not good to maintain
    For example:

Image

  • When it fails to fetch data, the function should return "null" --> This means that the Promise and "request" objects will need to be < type_we_need | null> --> Then we can do something with the returning "null" later

  • If we change the Promise and returning types, we need to consider every part of the code that is related to the API endpoint in the whole codebase, to see why the "full shape" object should be in the original code (if there are any reasons) and how this change will affect the UI and the current jobs ...

@AndyRae
Copy link
Member

AndyRae commented Jul 21, 2024

Yes I agree - this is a bit of debt we were basically fine with introducing as it works, is necessary for Next to build, and the early stages of the Next work had other priorities. This is still quite low priority though, and shouldn't be much work to undo.

@AndyRae AndyRae changed the title Concerns on logic inside API endpoints which are fetching data Fetching data pattern improvement Aug 23, 2024
@AndyRae AndyRae added this to the 2.3.0 milestone Sep 8, 2024
@AndyRae AndyRae modified the milestones: 2.4.0, 2.5.0 Nov 4, 2024
@AndyRae AndyRae modified the milestones: 2.5.0, 3.0.0 Dec 19, 2024
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

No branches or pull requests

2 participants