Skip to content

#22 Fixed bug with not able to removing GeoLocation out of Start Location Field#24

Merged
marcelreit merged 1 commit into
mainfrom
bug/22-can-not-delete-geolocation
Mar 30, 2026
Merged

#22 Fixed bug with not able to removing GeoLocation out of Start Location Field#24
marcelreit merged 1 commit into
mainfrom
bug/22-can-not-delete-geolocation

Conversation

@marcelreit

Copy link
Copy Markdown
Contributor

This pull request improves the handling of the "My Location" feature in the TankifyCalculator component to better respect user intent when they clear or interact with the start location field. The changes ensure that the user's manual input is not unintentionally overridden by background geolocation updates, and that translations and draft state are always up to date.

Enhancements to user location and input handling:

  • Introduced suppressAutoStartFromUserLocationRef, draftStartPointRef, startTextRef, and tRef to manage state and prevent auto-restoring "My Location" after the user clears the start field, unless explicitly requested.
  • Set suppressAutoStartFromUserLocationRef.current = true when the user clears the start field, and reset it to false when the user clicks "My Location". [1] [2]
  • Modified the geolocation event handler to check suppressAutoStartFromUserLocationRef, draftStartPointRef, and startTextRef before auto-filling the start location, ensuring user input is not overwritten. Also updated to use the latest translation reference.

State and effect management improvements:

  • Added useEffect hooks to keep refs (draftStartPointRef, startTextRef, tRef) in sync with their respective state variables.
  • Changed the dependency array of the geolocation event handling effect to [] (empty), ensuring it only runs on mount/unmount, since refs are now used for the latest values.

@marcelreit marcelreit self-assigned this Mar 30, 2026
@marcelreit marcelreit added the bug Something isn't working label Mar 30, 2026
@marcelreit marcelreit linked an issue Mar 30, 2026 that may be closed by this pull request
@marcelreit marcelreit merged commit c086043 into main Mar 30, 2026
2 checks passed
@marcelreit marcelreit deleted the bug/22-can-not-delete-geolocation branch March 30, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can not delete GeoLocation

1 participant