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

Unnecessary fetches when getting the sketches via the Create API #1849

Open
3 tasks done
kittaakos opened this issue Feb 1, 2023 · 0 comments
Open
3 tasks done

Unnecessary fetches when getting the sketches via the Create API #1849

kittaakos opened this issue Feb 1, 2023 · 0 comments
Labels
topic: cloud Related to Arduino Cloud and cloud sketches topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

Describe the problem

Pagination must be used when retrieving the sketches. This has been added in #875, but the proposed code does one extra fetch when all sketches have been loaded.

For example, when I have one single sketch, I will see two HTTP GETs:

HTTP GET: https://api-dev.arduino.cc/create/v2/sketches?user_id=me&limit=50&offset=0
HTTP GET: https://api-dev.arduino.cc/create/v2/sketches?user_id=me&limit=50&offset=50

To reproduce

Start IDE 2.0.3, log into the cloud, open dev tools, switch to the network tab, enable XHR/Fetch, reload the browser window, and see the unnecessary fetch with 50 offsets. I have one single sketch.

Screen Shot 2023-02-01 at 10 32 05

The second fetch response body is empty.

Screen Shot 2023-02-01 at 10 33 58

The other problem is that IDE2 runs the sketches fetch twice, and IDE2 runs the same fetches in every opened browser window.

Expected behavior

There are fewer number of remote fetches to the server.

Arduino IDE version

2.0.3

Operating system

macOS

Operating system version

12.5.1

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Feb 1, 2023
@kittaakos kittaakos changed the title IDE2 does one unnecessary fetch when getting the sketches via the Create API IDE2 does unnecessary fetches when getting the sketches via the Create API Feb 1, 2023
kittaakos pushed a commit that referenced this issue Apr 12, 2023
Ref: #1849
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@kittaakos kittaakos added the topic: cloud Related to Arduino Cloud and cloud sketches label Apr 13, 2023
kittaakos pushed a commit that referenced this issue Apr 20, 2023
Ref: #1849

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Apr 24, 2023
Ref: #1849

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@per1234 per1234 changed the title IDE2 does unnecessary fetches when getting the sketches via the Create API Unnecessary fetches when getting the sketches via the Create API Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cloud Related to Arduino Cloud and cloud sketches topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

1 participant