jreyesr / insomnia-plugin-batch-requests

An Insomnia plugin to repeatedly send a request, each time replacing some data with information from a CSV file, and collecting response data into the CSV file.
https://jreyesr.github.io/posts/insomnia-batch-requests/
MIT License
6 stars 0 forks source link

Request history not visible #10

Open CC007 opened 11 months ago

CC007 commented 11 months ago

Steps to reproduce

  1. Create a new request in any collection
  2. Use a batch variable
  3. Create a CSV file using that variable
  4. Run Batch Requests with the CSV file
  5. Press Ctrl+Shift+H or (attempt to) click the history on the top right of the right panel (the panel that shows responses)

Expected behavior The history menu drops down with all responses from the batch

Actual behavior Nothing happens when using the keyboard shortcut and the history button in the responses panel isn't there to click

Additional context

Therefore I expect that the history items do get added to the list, but the GUI doesn't get refreshed after doing so.

Possible solution Refresh the request history part of the GUI after running a request batch.

jreyesr commented 11 months ago

Hello @CC007, and thanks for the incredibly detailed issue report! That definitely looks like a bug, I'll check it out

jreyesr commented 11 months ago

The problem appears to be further upstream (i.e. not limited to this plugin, but it looks to me like it affects any plugin that programmatically makes requests, without the user clicking the Send button). I've opened an issue on Insomnia. You may want to keep an eye on it: https://github.com/Kong/insomnia/issues/6512

CC007 commented 11 months ago

Yea, I also took a look at it and the network object from the context doesn't seem to trigger an update on the response history component. I'm not very familiar with React though, so I couldn't find how normal requests trigger this update. Maybe looking for the component with the send button could help show how to trigger the update.

CC007 commented 11 months ago

Would it be possible to manually trigger a page redraw after a batch request, as a workaround for now?

jreyesr commented 11 months ago

I don't see a clean way of doing it, sadly. Plugins don't really have control over the page render, and since they operate outside of the React component model they can't force a component rerender by mutating some state.

CC007 commented 11 months ago

Well, let's hope that they fix their plugin API then.