Skip to content

feat: added optin support for pages - #1164

Merged
jsalaber merged 2 commits into
mainfrom
COR-3779-nextjs-pages-optin
Nov 4, 2025
Merged

jsalaber merged 2 commits into
mainfrom
COR-3779-nextjs-pages-optin

Conversation

@jsalaber

@jsalaber jsalaber commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Changes

  • added optin support for pages router in nextjs

Copilot AI review requested due to automatic review settings November 4, 2025 19:38
@jsalaber
jsalaber requested a review from a team as a code owner November 4, 2025 19:38
@vercel

vercel Bot commented Nov 4, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
js-sdks-web-elements Ready Ready Preview Comment Nov 4, 2025 8:42pm
js-sdks-with-provider Ready Ready Preview Comment Nov 4, 2025 8:42pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
js-sdks-next-js-page-router Ignored Ignored Nov 4, 2025 8:42pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Opt-In feature targeting in the Next.js SDK pages router, allowing features to be enabled based on user opt-in preferences retrieved from the DevCycle Opt-In API.

  • Introduces hasOptInEnabled function to check user opt-in status via API
  • Updates bucketing logic to fetch remote config when opt-in is enabled
  • Adds E2E tests for opt-in functionality with the pages router

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/nextjs/src/common/requests.ts New file implementing the opt-in API check with React cache
sdk/nextjs/src/pages/bucketing.ts Adds opt-in checking logic and integrates it into the bucketing decision flow
e2e/nextjs/pages-router/tests/pages-router.spec.ts Adds E2E tests for opt-in feature targeting scenarios
e2e/nextjs/pages-router/app/pages/optin/index.tsx New test page demonstrating opt-in feature integration
e2e/nextjs/pages-router/app/yarn.lock Updated package resolution hash
Comments suppressed due to low confidence (2)

sdk/nextjs/src/pages/bucketing.ts:111

  • Debug console.log statement should be removed before merging to production. This appears to be leftover debugging code that will pollute production logs.
    sdk/nextjs/src/pages/bucketing.ts:79
  • The useOptIn flag is computed but not passed to sdkConfigAPI. Unlike the server implementation in server/bucketing.ts which passes the opt-in information to the API, this pages router implementation doesn't include it in the API call parameters. This inconsistency may result in the API not being aware of the opt-in context when processing the request.
        const bucketedConfigResponse = await sdkConfigAPI(
            config.clientSDKKey!,
            user,
            obfuscated,
            useEdgeDB,
        )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk/nextjs/src/common/requests.ts Outdated
Comment thread sdk/nextjs/src/pages/bucketing.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk/nextjs/src/common/requests.ts
Comment thread sdk/nextjs/src/pages/bucketing.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk/nextjs/src/pages/bucketing.ts Outdated
@jsalaber
jsalaber merged commit 8226df4 into main Nov 4, 2025
14 checks passed
@jsalaber
jsalaber deleted the COR-3779-nextjs-pages-optin branch November 4, 2025 20:51
jonathannorris added a commit that referenced this pull request Jul 2, 2026
- js-yaml 3.14.1 -> 3.15.0 (medium, alerts #1175, #1176)
- js-yaml 4.1.0 -> 4.3.0 (medium, alerts #1171, #1172, #1173, #1174)
- webpack-dev-server -> 5.2.5 (medium, alerts #1167, #1168, #1169)
- http-proxy-middleware 2.0.9 -> 2.0.10 (medium, alerts #1164, #1165, #1166)
- @babel/core -> 7.29.7 (low, alerts #1139, #1140, #1163)
- undici -> 6.27.0 (low/medium/high, alerts #1154-#1161)
- tar -> 7.5.16 (medium, alerts #1149-#1152)
- ws 6.x -> 6.2.4, ws 7.x -> 7.5.11, ws 8.x -> 8.21.0 (high, alerts #1141, #1142, #1145)
- form-data 4.0.5 -> 4.0.6 (high, alerts #1143, #1144)
- protobufjs -> 7.6.4 (high/medium, alerts #1135, #1136)
- protobufjs-cli 1.2.2 -> 1.3.3 (high, alert #1132)
- launch-editor -> 2.14.1 (medium, alerts #1134, #1137, #1138)
- markdown-it 12.3.2 -> 14.3.0 (medium, alert #1133)
- joi 17.6.0 -> 17.13.4 (medium, alert #1125)

This branch was successfully deployed

2 active deployments
Preview – js-sdks-web-elements d238f5fa Deployed Nov 4, 2025 by vercel[bot]
Preview – js-sdks-with-provider d238f5fa Deployed Nov 4, 2025 by vercel[bot]
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.

4 participants