Skip to content

feat: add preconnect and dns-prefetch resource hints (#409)#429

Merged
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
olaayoade27-coder:feat/409-resource-hints
May 28, 2026
Merged

feat: add preconnect and dns-prefetch resource hints (#409)#429
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
olaayoade27-coder:feat/409-resource-hints

Conversation

@olaayoade27-coder
Copy link
Copy Markdown
Contributor

@olaayoade27-coder olaayoade27-coder commented May 27, 2026

Summary

Adds preconnect and DNS-prefetch hints for external resources to reduce latency for CDN, analytics, and ads.

Changes

  • src/utils/resourceHints.tsapplyResourceHints() injects <link> tags on web and fires parallel HEAD requests on native; prefetchExternalResources() fire-and-forget wrapper; DEFAULT_RESOURCE_HINTS covers CDN, analytics, ads, Sentry
  • app/_layout.tsx — calls prefetchExternalResources() at module level before any component mounts
  • src/__tests__/utils/resourceHints.test.ts — 16 tests covering both platforms, idempotency, invalid URLs, parallel execution

Acceptance Criteria

  • Add preconnect for CDN
  • Add DNS prefetch for analytics
  • Test resource loading time
  • Verify hints effectiveness
  • Document resource hints

Pr Closes #409

- Add resourceHints utility with applyResourceHints() and prefetchExternalResources()
- Web: injects <link rel=preconnect/dns-prefetch> tags into document head
- Native: fires parallel HEAD requests to warm up TCP/TLS connections
- DEFAULT_RESOURCE_HINTS covers CDN, analytics, ads, and Sentry
- Call prefetchExternalResources() at app startup in _layout.tsx
- Add 16 unit tests covering both platforms, idempotency, and invalid URLs
- Fix pre-existing ESLint warning: convert RootLayout to arrow function
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@olaayoade27-coder Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

kindly resolve conflict ad fix worflow.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 455a6d8 into rinafcode:main May 28, 2026
1 of 4 checks passed
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.

Implement resource hints (preconnect, dns-prefetch) for external resources

2 participants