-
Notifications
You must be signed in to change notification settings - Fork 31
Post place lookups: Using static file on CDN #3947
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
Conversation
…try file located on (soon to be) CDN, that we can download on-demand when we need to. This is more up-to-date than the package from NPM was, and we can keep it maintained across frontend versions without having to upgrade every app when there are changes upstream.
📝 WalkthroughWalkthroughThe PR removes the "norway-postal-codes" npm dependency and replaces it with a data-fetching approach. Postal code data is now fetched from an external URL using React Query instead of being bundled as a package. Supporting changes include adding new types, query functions, URL constants, test mocks, and updating related test assertions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…led because there were 5 requests. It's probably something other than the post code lookup
|
|
The automatic backport to The release branch Manual backport required: # Checkout the release branch
git checkout release/v4.24
git pull origin release/v4.24
# Create backport branch
git checkout -b backport/3947
# Cherry-pick the merge commit
git cherry-pick dffa0fc410641cbaff05ba32f06425e85c52c490
# Resolve conflicts, then:
git add .
git cherry-pick --continue
# Push and create PR
git push origin backport/3947 |
* Replacing the zip code lookup (once again) with a single static registry file located on (soon to be) CDN, that we can download on-demand when we need to. This is more up-to-date than the package from NPM was, and we can keep it maintained across frontend versions without having to upgrade every app when there are changes upstream. * Bringing back the at least 4 and at most 5 assertion, as the test failed because there were 5 requests. It's probably something other than the post code lookup * Updating URL to use CDN --------- Co-authored-by: Ole Martin Handeland <git@olemartin.org>
* Replacing the zip code lookup (once again) with a single static registry file located on (soon to be) CDN, that we can download on-demand when we need to. This is more up-to-date than the package from NPM was, and we can keep it maintained across frontend versions without having to upgrade every app when there are changes upstream. * Bringing back the at least 4 and at most 5 assertion, as the test failed because there were 5 requests. It's probably something other than the post code lookup * Updating URL to use CDN --------- Co-authored-by: Ole Martin Handeland <git@olemartin.org>



Description
This tests out an alternative fix for the recent post place lookup problem. Instead of relying on the APIs from Posten/Bring (which have been down today and yesterday), and the quickfix for using an older NPM package (#3943), this has an alternative approach discussed during a meeting today.
The plan is to place a static file on CDN the frontend can download whenever lookups are needed. I managed to get the file down to ~13kb when brotli compressed, using a two-stage lookup to get from zip code to post place from a fairly simple JSON structure. We should be able to keep this file up-to-date on CDN via a script that downloads and re-codes the source - something we can run periodically. We trust our own CDN to be as available as our frontend already is.
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.