Skip to content
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

feat: Allow users to customize fetch behavior #1599

Conversation

rafaeelaudibert
Copy link
Member

@rafaeelaudibert rafaeelaudibert commented Dec 11, 2024

NextJS SSR v15.1+ will not cache fetch requests by default, but some users might want that, specially in development mode. We're now allowing them to customize our fetch requests by setting the new fetch_options setting when calling posthog.init

This needs to be used carefully, but it should be extremely powerful and useful for NextJS users. We'll add documentation about it on posthog.com soon.

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

See #1529

NextJS SSR v15.1+ will not cache `fetch` requests by default, but some users might want that, specially in development mode.
We're now allowing them to customize our `fetch` requests by setting the new `fetch_options` setting when calling `posthog.init`

This needs to be used carefully, but it should be extremely powerful and useful for NextJS users. We'll add documentation about it on `posthog.com` soon.
Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Dec 11, 2024 9:55pm

Copy link

github-actions bot commented Dec 11, 2024

Size Change: +753 B (+0.02%)

Total Size: 3.21 MB

Filename Size Change
dist/array.full.es5.js 261 kB +75 B (+0.03%)
dist/array.full.js 364 kB +75 B (+0.02%)
dist/array.full.no-external.js 363 kB +75 B (+0.02%)
dist/array.js 178 kB +76 B (+0.04%)
dist/array.no-external.js 177 kB +75 B (+0.04%)
dist/main.js 179 kB +76 B (+0.04%)
dist/module.full.js 364 kB +75 B (+0.02%)
dist/module.full.no-external.js 363 kB +75 B (+0.02%)
dist/module.js 178 kB +76 B (+0.04%)
dist/module.no-external.js 177 kB +75 B (+0.04%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 206 kB
dist/customizations.full.js 12.6 kB
dist/dead-clicks-autocapture.js 14.4 kB
dist/exception-autocapture.js 9.48 kB
dist/external-scripts-loader.js 2.48 kB
dist/recorder-v2.js 115 kB
dist/recorder.js 115 kB
dist/surveys-preview.js 57.6 kB
dist/surveys.js 63.3 kB
dist/tracing-headers.js 1.75 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

@rafaeelaudibert rafaeelaudibert added the bump minor Bump minor version when this PR gets merged label Dec 11, 2024
@rafaeelaudibert rafaeelaudibert merged commit 7becae3 into main Dec 12, 2024
17 checks passed
@rafaeelaudibert rafaeelaudibert deleted the 1529-posthog-js-allow-customization-of-posthog-js-cache-and-next-configuration branch December 12, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants