Skip to content

Fix: conditionally generate user session based on disableUserSession …#781

Merged
jerrypena1 merged 1 commit into
masterfrom
disableUserSession-fix
Mar 13, 2026
Merged

Fix: conditionally generate user session based on disableUserSession …#781
jerrypena1 merged 1 commit into
masterfrom
disableUserSession-fix

Conversation

@jerrypena1

Copy link
Copy Markdown
Collaborator

…flag

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts Klevu Core behavior so user-session–dependent logic is skipped when disableUserSession is enabled, preventing session access/generation in consent and KMC recommendation flows.

Changes:

  • In kmcRecommendation, only reads user segments (sids) when user sessions are enabled.
  • In KlevuConfig.setConsentGiven, only generates a user session when user sessions are enabled.

Reviewed changes

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

File Description
packages/klevu-core/src/queries/kmcRecommendation/kmcRecommendation.ts Avoids accessing KlevuUserSession (segments) when disableUserSession is true.
packages/klevu-core/src/config.ts Prevents session generation during consent flow when disableUserSession is true.

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

Comment on lines +211 to +213
if (!this.disableUserSession) {
KlevuUserSession.getDefault().generateSession()
}
Comment thread packages/klevu-core/src/config.ts
@jerrypena1 jerrypena1 merged commit 1f5ae93 into master Mar 13, 2026
5 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.

2 participants