Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(web): deselect zone on navigate back #7415

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function App(): ReactElement {
useEffect(() => {
if (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'android') {
Cap.addListener('backButton', () => {
if (window.location.pathname === '/map') {
if (window.location.pathname === '/map/24h') {
VIKTORVAV99 marked this conversation as resolved.
Show resolved Hide resolved
Cap.exitApp();
} else {
window.history.back();
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default function MapPage({ onMapLoad }: MapPageProps): ReactElement {
useEffect(() => {
// Run when the selected zone changes
// deselect and dehover zone when navigating to /map (e.g. using back button on mobile panel)
if (map && location.pathname === '/map' && selectedZoneId) {
if (map && location.pathname.startsWith('/map') && selectedZoneId) {
map.setFeatureState(
{ source: ZONE_SOURCE, id: selectedZoneId },
{ selected: false, hover: false }
Expand Down
Loading