Issue with Inbound Account and Folder ID in Emails Page

I’m encountering an issue on the Emails page when switching between inboxes for different inbound accounts.

Here’s what happens:

  1. When the Emails page first loads, the default inbound account is not opened. Instead, another account’s folder ID is used.
  2. If I inspect the URL after switching inboxes, I can see the correct folder ID in the URL, for example:
    http://…/#/emails/index?folders_id=33d90e45-21dd-22ee-a8bb-673484…
  3. However, in the PHP $_REQUEST, the folder ID I receive is incorrect. It seems to always return the folder ID for the same account, regardless of the folder ID specified in the URL. (2aa4a0a4-51e2-f5a0-10ae-673203…)

It appears that from the front end, I only get one folder ID in the request, and it does not correspond to the folder ID shown in the URL.

Has anyone encountered this issue before? Could this be a caching issue or a bug in how folder IDs are handled in the front end or backend? Any guidance on how to resolve this would be greatly appreciated.

You can clear cache and try it out.


Otherwise, if it is bug, you can raise an issue on the GitHub page.

I cleared the cache, but that didn’t help. I found that in the StoreQuery class, loadQuery saves the wrong folder ID. In the populateRequest() method, $_REQUEST has the correct folder ID, but it gets overwritten by the data returned from loadQuery. However, I couldn’t find where the data for StoreQuery::getStoredQueryForUser($name) comes from.
Additionally, I’m not sure why this issue is occurring now and not from the first time I used it.
I’ve added conditions to prevent overwriting the folder ID, but I think this is not a thorough solution.