Wrong number of requests in collection info
How to reproduce:
- Right-click on the collection on the left panel.
- Open "Settings" on the context menu.
- Click the "Info" tab in the center panel.
- The number of "Requests" is always the actual number
+ 1.
This number does not match the number shown on the Runner page.
Hey @blackr1234, what version of Bruno are you using right now? I tried recreating the issue on the latest version v1.12.3, but I wasn't able to.
@sanjai0py
Sorry forgot to mention, it was 1.12.2.
Let me try the new version tonight, thanks!
The issue is also happening in the latest version 1.12.3.
Please find below screenshot.
As you can see above, I have a brand new collection named abc and there is no request at all (the tree navigation menu is already expanded). However, the number of requests is 1.
Now, I add a new request:
As you can see above, the number of requests is now 2.
If we check the Runner page, we can find the correct number of requests:
OS: Windows 11
Bruno version: 1.12.3 (portable, free version)
I would suggest reusing existing function for calculating the number of requests rather than writing two different implementations and using them in different places.
The calculation for the Runner page:
You have <span className="font-medium">{totalRequestsInCollection} requests in this collection.
comes from below function:
https://github.com/usebruno/bruno/blob/main/packages/bruno-app/src/utils/collections/index.js#L616
The wrong one for the Collection page - Info tab:
https://github.com/usebruno/bruno/blob/main/packages/bruno-app/src/components/CollectionSettings/Info/index.js#L4
Root cause analysis:
- I find that the problematic code actually treats
bruno.jsonas a request, that's why it's always the actual number+ 1. - By deleting the
bruno.jsonfile, I can see that the number of requests on the collection info page becomes correct. Undoing the deletion reverts the number of requests back to the actual number+ 1.
@sanjai0py
Now I wonder why it doesn't happen to you. Is the issue platform-specific for some reason? 🤔