Skip to content

PB-1236: infobox doesn't change language when open#1209

Merged
sommerfe merged 1 commit intodevelopfrom
fix-pb-1236-infobox-change-language
Jan 21, 2025
Merged

PB-1236: infobox doesn't change language when open#1209
sommerfe merged 1 commit intodevelopfrom
fix-pb-1236-infobox-change-language

Conversation

@sommerfe
Copy link
Contributor

@sommerfe sommerfe commented Jan 20, 2025

@sommerfe sommerfe self-assigned this Jan 20, 2025
@github-actions github-actions bot added the bug label Jan 20, 2025
@cypress
Copy link

cypress bot commented Jan 20, 2025

web-mapviewer    Run #4355

Run Properties:  status check passed Passed #4355  •  git commit d9b3be2c3b: Merge pull request #1209 from geoadmin/fix-pb-1236-infobox-change-language
Project web-mapviewer
Branch Review develop
Run status status check passed Passed #4355
Run duration 01m 48s
Commit git commit d9b3be2c3b: Merge pull request #1209 from geoadmin/fix-pb-1236-infobox-change-language
Committer Felix Sommer
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 48
View all changes introduced in this branch ↗︎

@sommerfe sommerfe force-pushed the fix-pb-1236-infobox-change-language branch 3 times, most recently from dca4513 to 605d67f Compare January 21, 2025 07:44
@sommerfe sommerfe requested review from ltkum, ltshb and pakb January 21, 2025 07:54
@sommerfe sommerfe marked this pull request as ready for review January 21, 2025 07:54
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

While this works for the language change, it introduces a new unwanted behavior and the logic behind it doesn't sit well with me (if we want to trigger something on a language change, we should put the watcher on the language).

Comment on lines +36 to +44
watch(activeLayers, (newActiveLayer) => {
if (showLayerDescriptionIndex.value !== null) {
onShowLayerDescription(
newActiveLayer[showLayerDescriptionIndex.value],
showLayerDescriptionIndex.value
)
}
})

Copy link
Contributor

@ltkum ltkum Jan 21, 2025

Choose a reason for hiding this comment

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

We should be watching a language change, not a layer change, here. This will be called if I add or remove a layer from the active layers, which is not what we want.
For example, if I add the public transports stops layer, click somewhere, and add the RBD building layer, the popup will now show the building layer which is not what we want.

We might need to do a quick check with getIndexOfActiveLayerById to find the layer again after the lang change, do something like

if (showLayerDescription.value) {
showLayerDescription.value = activeLayers.value[getIndexOfActiveLayerById(showLayerDescription.value.id)]
}

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed about this with Pascal, and we have found a more elegant solution, but it is quite difficult to explain. He will either send you a gist (or make a commit) on this issue.

Also, I made a mistake about the active layers side effects in this case :)

@sommerfe sommerfe force-pushed the fix-pb-1236-infobox-change-language branch from 605d67f to 9620a7c Compare January 21, 2025 12:43
@sommerfe sommerfe force-pushed the fix-pb-1236-infobox-change-language branch from 9620a7c to b524adc Compare January 21, 2025 13:18
@sommerfe sommerfe requested a review from ltkum January 21, 2025 13:28
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

looks good to me :)

@sommerfe sommerfe merged commit d9b3be2 into develop Jan 21, 2025
3 checks passed
@sommerfe sommerfe deleted the fix-pb-1236-infobox-change-language branch January 21, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants