Skip to content

Commit 205179a

Browse files
authored
Fix most-recently-used-entry delete bug (#1296)
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 😁 * use editEntryAndScroll() in deleteEntry() 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. * check MRU entry actually exists 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. * tweak S/R GH issue template
1 parent fa786ae commit 205179a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

.github/ISSUE_TEMPLATE/send-receive-with-flex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ assignees: ''
99

1010
If your project has been put on hold and you want to keep the details of your project private, please email languageforgeissues@sil.org with the following information.
1111

12-
The Language Forge project is run as an open-source and open-issue-tracker project, meaning that all our code and issues are publicly available on the internet. Information you submit below should not container private or personal information.
12+
The Language Forge project is run as an open-source and open-issue-tracker project, meaning that all our code and issues are publicly available on the internet. Please do not include any sensitive information (passwords, names, locations, etc.) in this issue report.
1313

1414

1515
Project name:

src/angular-app/languageforge/lexicon/editor/editor.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ export class LexiconEditorController implements angular.IController {
528528
if (iShowList !== 0) {
529529
iShowList--;
530530
}
531-
this.setCurrentEntry(this.visibleEntries[iShowList]);
531+
this.editEntryAndScroll(this.visibleEntries[iShowList].id);
532532
} else {
533533
this.returnToList();
534534
}
@@ -982,7 +982,7 @@ export class LexiconEditorController implements angular.IController {
982982

983983
// see if there is a most-recently viewed entry in the cache
984984
await this.offlineCacheUtils.getProjectMruEntryData().then(data => {
985-
if(data && data.mruEntryId){
985+
if(data && data.mruEntryId && this.editorService.getIndexInList(data.mruEntryId, this.entries) != null){
986986
entryId = data.mruEntryId;
987987
}
988988

0 commit comments

Comments
 (0)