Skip to content

Fix most-recently-used-entry delete bug#1296

Merged
megahirt merged 3 commits into
developfrom
feature/most-recently-viewed-entry
Feb 4, 2022
Merged

Fix most-recently-used-entry delete bug#1296
megahirt merged 3 commits into
developfrom
feature/most-recently-viewed-entry

Conversation

@megahirt

@megahirt megahirt commented Feb 4, 2022

Copy link
Copy Markdown
Collaborator

Description

This is a follow up PR to #1252 where during QA testing @longrunningprocess discovered a bug whereby deleting an entry caused the MRU cache and URL to not be updated, thereby creating a situation where the app could go to an invalid state.

Addresses testing and comments called out in #1252

Also contains an unrelated tweak to a GH issue template 😁

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing on your branch

Please describe how to test and/or verify your changes. Provide instructions so we can reproduce. Please also provide relevant test data as necessary. These instructions will be used for QA testing below.

  • Given a dictionary with many entries, click on an entry. Notice the URL and entry ID. Delete an entry, notice the URL changes to reflect where the currently selected entry (the one above it I believe).
  • Given a dictionary with many entries, click on an entry. Copy the URL of the entry. Delete the entry. Paste in the URL you copied into the browser. The dictionary will load the next available entry and not show an error state of a blank screen.

Checklist

  • I have performed a self-review of my own code
  • I have reviewed the title/description of this PR which will be used as the squashed PR commit message
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

qa.languageforge.org testing

Reviewers: add/replace your name below and check the box to sign-off/attest the feature works as expected on qa.languageforge.org

This replaces the low-level setCurrentEntry() method with the higher-level editEntryAndScroll() method that we use to change entry state.  The higher-level method handles URL updating and MRU cache updates among other things.

This fixes a bug where deleting an entry did not update the URL or update the MRU cache, which could result in an error state under certain circumstances.
Add a check to ensure the MRU entry actually exists in the list before setting the entryId.

The previous commit ensures that the MRU cache is updated upon deleting an entry, so I'm not 100% sure that this check is needed, but it shouldn't hurt, so I think it's safe to add as a precaution against an invalid state.
@github-actions

github-actions Bot commented Feb 4, 2022

Copy link
Copy Markdown

Unit Test Results

    1 files      1 suites   12s ⏱️
373 tests 373 ✔️ 0 💤 0

Results for commit 4ed0396.

♻️ This comment has been updated with latest results.

@megahirt megahirt merged commit 205179a into develop Feb 4, 2022
@megahirt megahirt deleted the feature/most-recently-viewed-entry branch February 4, 2022 13:04
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