mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-09 01:35:52 +08:00
73e990fc05
Summary: Previously, after creating a new folder, the UI would indicate that the new folder had children, even though it didn't. This was caused by duplicate models in our `MutableQueryResultSet` for the user's categories. Basically, we would sync the server version of the folder before the `SyncbackTask` for the new folder returned its `serverId`. Without the `serverId`, the synced version of the folder couldn't yet be tied to the optimistic folder, so a second row was created in the database. This second row is removed when the `syncbackTask` does return the `serverId`, because we persist the optimistic folder with a `REPLACE INTO` query. (This deletes other rows with the same id.) However, since this was done inside a `persist` change with the `serverId` and no `unpersist` was ever recorded for the `clientId`, our `MutableQueryResultSet` never removed the `clientId` model. To address this, this diff adds a check in `updateModel` to see if the `serverId` is being added. If it is, and both the `serverId` and `clientId` exist in the `_ids` list, we remove the `clientId`. The children indicator does still briefly show up while there are still two separate rows for that folder in the database. If we want to get rid of this completely, we would have to ensure that we do not sync the folder before the `syncbackTask` returns the `serverId`. However, this would probably be pretty involved, and for not much gain. This fix is much simpler and reduces most of the issue. Test Plan: manual Reviewers: juan, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D4228 |
||
---|---|---|
.. | ||
components | ||
fixtures | ||
models | ||
n1-spec-runner | ||
registries | ||
services | ||
stores | ||
tasks | ||
themes | ||
utils | ||
action-bridge-spec.coffee | ||
async-test-spec.es6 | ||
auto-update-manager-spec.coffee | ||
buffered-process-spec.coffee | ||
database-object-registry-spec.es6 | ||
default-client-helper-spec.coffee | ||
list-selection-spec.coffee | ||
mail-rules-processor-spec.coffee | ||
mailbox-perspective-spec.es6 | ||
menu-manager-spec.coffee | ||
module-cache-spec.coffee | ||
nylas-api-spec.coffee | ||
nylas-env-spec.es6 | ||
nylas-protocol-handler-spec.es6 | ||
nylas-test-utils.coffee | ||
package-manager-spec.coffee | ||
package-spec.coffee | ||
spellchecker-spec.es6 | ||
undo-stack-spec.es6 |