Skip to content

web: All tabs closed when any note is deleted.#9252

Open
NeedsChloesure wants to merge 2 commits intostreetwriters:betafrom
NeedsChloesure:fix/web-tabs
Open

web: All tabs closed when any note is deleted.#9252
NeedsChloesure wants to merge 2 commits intostreetwriters:betafrom
NeedsChloesure:fix/web-tabs

Conversation

@NeedsChloesure
Copy link
Contributor

The logic was missing a check to ensure that only the tabs that correspond to the recently deleted object were being marked for closure. The lack of this check meant that for any deleted note item, all tabs would pass the if (isDeleted(item) || isTrashItem(item)) check since the open tab loop runs on every tab for every item.

Signed-off by: Chloe Oletto <NeedsChloesure@riseup.net>
const clearIds: string[] = [];
for (const session of sessions) {
if (session.type === "new") continue;
if (session.note.id !== item.id) continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check on line 297 is doing the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the check on line 297 and definition of NoteId. NoteId isn't set when the note is deleted, which makes the check following the definition fail. Why check if the incoming item is deleted before grabbing it's ID? Isn't it just faster to check the IDs up front? Are there cases where we do not have this information available in item?

For the potential edge case where a content ID is passed here, wouldn't the note ID still follow (or already gone through)?

…are reopened.

Signed-off By: Chloe Oletto <NeedsChloesure@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants