Skip to content

Commit

Permalink
Fix: Prevent re-creation of uiMapRouletteMenu to ensure synchronization
Browse files Browse the repository at this point in the history
- Resolved issue where uiMapRouletteMenu was being re-created, causing desynchronization with selectMode and UiSystem.
- Ensured that the _qaItem variable is properly defined during menu rendering.
- Improved code stability by maintaining a single instance of uiMapRouletteMenu.
  • Loading branch information
tannerwuster committed Dec 13, 2024
1 parent 1171786 commit 5cff61c
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 64 deletions.
2 changes: 1 addition & 1 deletion data/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ en:
id_title: Challenge Id / Task Id
id_placeholder: Challenge IDs
instruction_title: Instructions
fixedIt: I fixed it!
fixed: I fixed it!
cantComplete: Can't Complete
alreadyFixed: Already Fixed
notAnIssue: Not an Issue
Expand Down
2 changes: 1 addition & 1 deletion data/l10n/core.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@
"id_title": "Challenge Id / Task Id",
"id_placeholder": "Challenge IDs",
"instruction_title": "Instructions",
"fixedIt": "I fixed it!",
"fixed": "I fixed it!",
"cantComplete": "Can't Complete",
"alreadyFixed": "Already Fixed",
"notAnIssue": "Not an Issue",
Expand Down
3 changes: 2 additions & 1 deletion modules/modes/SelectMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ export class SelectMode extends AbstractMode {

} else if (datum instanceof QAItem && datum.service === 'maproulette') {
sidebarContent = uiMapRouletteEditor(context).error(datum);
uiMapRouletteMenu(context).error(datum);
let uiSystem = this.context.systems.ui;
uiSystem.MapRouletteMenu.error(datum);
sidebarContent
.on('change', () => {
gfx.immediateRedraw(); // force a redraw (there is no history change that would otherwise do this)
Expand Down
3 changes: 1 addition & 2 deletions modules/ui/maproulette_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export function uiMapRouletteEditor(context) {

buttonSection.select('.fixedIt-button')
.attr('disabled', isSaveDisabled(_qaItem))
.text(l10n.t('map_data.layers.maproulette.fixedIt'))
.text(l10n.t('map_data.layers.maproulette.fixed'))
.on('click.fixedIt', function(d3_event, d) {
fixedIt(d3_event, d, selection);
});
Expand Down Expand Up @@ -410,7 +410,6 @@ export function uiMapRouletteEditor(context) {
const mapRouletteService = context.services.maproulette;
if (mapRouletteService) {
mapRouletteService.nearbyTaskEnabled = isChecked;
// console.log('Nearby Task feature is now', isChecked ? 'enabled' : 'disabled');
}
}

Expand Down
Loading

0 comments on commit 5cff61c

Please sign in to comment.