bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Wrong number of requests in collection info

Open blackr1234 opened this issue 1 year ago • 4 comments

How to reproduce:

  1. Right-click on the collection on the left panel.
  2. Open "Settings" on the context menu.
  3. Click the "Info" tab in the center panel.
  4. The number of "Requests" is always the actual number + 1.

This number does not match the number shown on the Runner page.

blackr1234 avatar Mar 24 '24 12:03 blackr1234

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 avatar Mar 27 '24 06:03 sanjai0py

@sanjai0py Sorry forgot to mention, it was 1.12.2. Let me try the new version tonight, thanks!

blackr1234 avatar Mar 27 '24 07:03 blackr1234

The issue is also happening in the latest version 1.12.3.

Please find below screenshot.

image

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:

image

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:

image


OS: Windows 11 Bruno version: 1.12.3 (portable, free version)

blackr1234 avatar Mar 28 '24 15:03 blackr1234

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.json as a request, that's why it's always the actual number + 1.
  • By deleting the bruno.json file, 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? 🤔

blackr1234 avatar Mar 28 '24 15:03 blackr1234