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

SDK: payload hydration, experiment blocking, enhanced auto-wrapper #2450

Merged
merged 26 commits into from
May 2, 2024

Conversation

bryce-fitzsimons
Copy link
Member

@bryce-fitzsimons bryce-fitzsimons commented Apr 29, 2024

Features and Changes

  • v1.0.0 of JS and React SDKs
  • Enhanced auto wrapper SDK

From the changelog:

  • New init function as a replacement for loadFeatures.
  • Support payload import/export via init({ payload }), setPayload, and getPayload. Better supports hybrid apps, as well as externalizing the SDK Payload.
  • Ability to block or control experiments by various context properties
    • blockedChangeIds targets individual experiments
    • disableVisualExperiments prevents visual experiments from running
    • disableJsInjection blocks any visual experiments which write <script> code
    • disableUrlRedirectExperiments prevents redirect experiments from running
    • disableCrossOriginUrlRedirectExperiments blocks redirects if the origin changes
    • jsInjectionNonce injects a nonce string onto any generated <sript> tags
    • disableExperimentsOnLoad prevents AutoExperiments from running automatically; triggerAutoExperiments manually triggers them.
  • Provide a custom DOM mutation method by setting context applyDomChangesCallback. Useful for server-side rendering visual experiments.
  • Get a list of triggered experiments by their changeId (a new, more-specific AutoExperiment identifier) via getCompletedChangeIds.
  • Disable in-memory cache via configureCache({ disableLocalCache: true })
  • Easier streaming customization via init({ streaming: true }).
  • Prefetch payloads on backend SDK instances via prefetchPayload(). Also allows feature repository SSE streaming without connection each SDK instance to streaming (useful for NodeJS).
  • Many improvements to auto.min.js script
    • Payload hydration via payload context property
    • Support sticky bucketing via useStickyBucketService context property (accepts "cookie" and "localStorage"); override cookie or localStorage key via stickyBucketPrefix context property.
    • Hydrate sticky bucket docs by setting context stickyBucketAssignmentDocs (useful for SSR hydration without reliance on cookies)
    • Customize attributes/cookies via uuidCookieName (default "gbuuid") and uuidKey (default "id").
    • Force a uuid cookie write on load via persistUuidOnLoad (useful for SSR hydration)

Dependencies

Testing

Screenshots

Copy link

github-actions bot commented Apr 29, 2024

Your preview environment pr-2450-bttf has been deployed.

Copy link

github-actions bot commented Apr 30, 2024

Deploy preview for docs ready!

✅ Preview
https://docs-14zldn621-growthbook.vercel.app

Built with commit faa081d.
This pull request is being automatically deployed with vercel-action

@bryce-fitzsimons bryce-fitzsimons merged commit 2e36c98 into main May 2, 2024
6 checks passed
@bryce-fitzsimons bryce-fitzsimons deleted the sdk-payload-hydration-etc branch May 2, 2024 21:59
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