Skip to content

[MOL-20560][NL] Add new event listeners-ready to location-field#576

Merged
weili-govtech merged 6 commits intomainfrom
MOL-20560
Apr 15, 2026
Merged

[MOL-20560][NL] Add new event listeners-ready to location-field#576
weili-govtech merged 6 commits intomainfrom
MOL-20560

Conversation

@namlh023
Copy link
Copy Markdown
Contributor

Changes

In the new OS 2.0 enhancement, we need to display the location map immediately on page load in the mobile app. Normally, show-location-modal is triggered when the user clicks the location field, but now it runs on mount.

To support this, the location-field must register its show-location-modal event listener before the event is dispatched. This MR introduces a location-field listener-ready signal so consumers know when it’s safe to dispatch the event.

  • [delete] branch

Changelog entry

  • Add new event: listeners-ready to location-field

Additional information

@namlh023 namlh023 changed the title [MOL-20560][NL] [MOL-20560][NL] Add new event listeners-ready to location-field Apr 10, 2026
@weili-govtech
Copy link
Copy Markdown
Contributor

shall we call it mounted event instead? listeners-ready imply all the listeners are ready but it is not the case

@namlh023
Copy link
Copy Markdown
Contributor Author

‘Mounted’ is a reasonable name, but it might suggest that it’s safe to dispatch the event as soon as the component mounts. In our case, there’s a short gap where the component is mounted but the listeners may not yet be fully registered (e.g., the show-location-modal listener is added in useEffect). The intent is to signal when the listeners are actually ready, so consumers know it’s safe to dispatch the event at that point.

In case if we choose ‘mounted’, then we can add a comment to clarify this behavior.

@weili-govtech
Copy link
Copy Markdown
Contributor

you have a point too, since we want to ensure show-location-modal event is ready, how about naming show-location-modal-ready?

@@ -120,7 +120,7 @@ export class GeolocationPositionErrorWrapper extends Error {
/** fired after the location field registers its internal event listeners and is ready for external triggers */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/** fired after the location field registers the `show-location-modal`  event listener and is ready for external triggers */

@weili-govtech weili-govtech merged commit e9c816b into main Apr 15, 2026
1 check passed
@weili-govtech weili-govtech deleted the MOL-20560 branch April 15, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants