Closed WesleyBranton closed 4 years ago
I did some tests here with the console log and it seems to works fine the search for new questions (Firefox version 69.0.1 searching questions in English). Unfortunately had no new opened question... So I could not see if it is added to the popup, however, the search is done normally.
So, I believe I have fixed the problem. The issue was that a single HTTP request object was defined when the extension opened and that was shared for all requests. This meant that, when making multiple requests, the second one was overwriting the first. So when the extension received the request from the first API call, it did nothing with it because the onload was looking for the second request, which had overwritten the first.
To fix this, I stopped the HTTP request object from being created at the start. Instead, an array is created when we call the API and each element in the array becomes a new HTTP request object, essentially giving each request it's own HTTP request object.
I've only tested this using my own custom server that I set up to mimic the SUMO API requests, but I believe the concept should work as intended with the actual SUMO API system. Nevertheless, may be worth testing before releasing to AMO.
I've been able to reproduce this issue on multiple profiles. When I have selected to monitor Firefox and Firefox Enterprise, the questions will load originally to populate the list. However, the Firefox questions will never be added when new ones are posted or removed when the existing questions get answered. The Firefox Enterprise questions will though. Monitoring just the Firefox category works fine.
I'm not sure if the issue is exclusive to English locale, but that's the locale I'm using.
My first impression is that it's probably something to do with the check that the add-on runs to make sure that the questions are actually new to add to the list. Probably something to do with the fact that one is "firefox" and the other is "firefox-enterprise".