[MOL-21191][WEIDONG] add restrictNonSGLocation to block out-of-Singapore selections using SLA National Map Polygon boundary - #676
Open
weidong-gws wants to merge 5 commits into
Open
[MOL-21191][WEIDONG] add restrictNonSGLocation to block out-of-Singapore selections using SLA National Map Polygon boundary#676weidong-gws wants to merge 5 commits into
weidong-gws wants to merge 5 commits into
Conversation
…ore selections using SLA National Map Polygon boundary
mauw-paloit
reviewed
Aug 3, 2026
mauw-paloit
reviewed
Aug 3, 2026
…return confirm guard per review
wilsontbx
reviewed
Aug 3, 2026
wilsontbx
reviewed
Aug 3, 2026
…trigger, treat 0 as valid coordinate, fix stale restrictNonSGLocation on runtime toggle
Resolve conflict in location-field.spec.tsx: keep restrictNonSGLocation test suite alongside upstream's dirtyStateTestSuite refactor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Suggested change
| }, [isRecaptchaReady, validSGLocation]); |
Author
There was a problem hiding this comment.
@weili-govtech thanks for your review, i just pushed another commit to add restrictNonSGLocation and mustHavePostalCode to prefill effect deps. Please help review again, thanks.
… to prefill effect deps per review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add restrictNonSGLocation to block out-of-Singapore selections using SLA National Map Polygon boundary
Type of changes
Description of changes
Adds an opt-in restrictNonSGLocation prop to location-field that prevents confirming or submitting locations outside Singapore.
Classification: a coordinate is judged in/out of Singapore against the coastal outlines of SLA's National Map Polygon dataset (data.gov.sg), embedded as singapore-boundary.data.ts and produced by scripts/generate-singapore-boundary.js (point-in-polygon + a 10 km near-shore water tolerance). A JOHOR (MALAYSIA) building name short-circuits to "outside". Areas inside Singapore with no nearby address (sea off Changi, reservoirs) remain selectable.
Three enforcement layers, one shared predicate (LocationHelper.checkIsLocationOutsideSG): (1) on Confirm, an out-of-SG selection shows the "This location is outside Singapore." prompt with an Edit location button (map stays open) instead of confirming, and fires the error event with errorType: "NonSGLocationError"; (2) out-of-SG prefill values are cleared; (3) a yup submit rule blocks such values.
Non-breaking & opt-in (behaviour unchanged when the prop is absent). Custom copy via validation: [{ nonSGLocation: true, errorMessage: "…" }].
Checklist
Screenshots