mozillabrasil / sumo_live_helper

Helper Add-on for SUMO forum contributors
https://addons.mozilla.org/firefox/addon/sumo-live-helper-/
Mozilla Public License 2.0
7 stars 8 forks source link

Questions appear on list if settings change while waiting for API call #182

Closed WesleyBranton closed 3 years ago

WesleyBranton commented 3 years ago

If the user settings change in the brief window between when the API call is sent and the response is received from the SUMO server, questions that no longer fit the user's settings may still appear on the list.

This can easily be reproduced if the sidebar is open by going to the settings and quickly toggling on and off a product or language setting. The new questions will still be added to the list when they are fetched from the API because invalid questions are only deleted when the setting is changed. The questions are being added after that point because of the time it takes for the API call to complete.

This can be solved by adding a simple check to the function that handles the API response to discard any responses that no longer align with the user's settings.