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

fix(commerce): populate context.user.userAgent with navigatorContext #4113

Merged
merged 14 commits into from
Jun 27, 2024

Conversation

Spuffynism
Copy link
Contributor

@Spuffynism Spuffynism commented Jun 21, 2024

headless was populating the context.user.userAgent property with what was set through the setUser. With this PR, we extract the userAgent and the referrer from the relay instance and use these values instead. This makes using the headless commerce controllers less error-prone.

⚠️ This means we can remove the setUser action (and its sibling method on the context controller), and setView's referrer parameter, which I do in this PR. Do you think this makes sense? Is there a use case for allowing manual control over these parameters? @samisayegh @louis-bompart @fbeaudoincoveo ?

CAPI-1091

@developer-experience-bot
Copy link
Contributor

developer-experience-bot bot commented Jun 21, 2024

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 204.9 204.9 0
commerce 293.4 293.7 0.1
search 372.6 372.9 0.1
insight 352.6 352.9 0.1
product-listing 267 267.3 0.1
product-recommendation 170.8 170.8 0
recommendation 217.8 217.8 0
ssr 365.4 365.7 0.1

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
product-recommendation 0 10 0
product-listing 0 13 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
product-recommendation : missing SSR support
product-listing : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

@fbeaudoincoveo
Copy link
Contributor

Is there a use case for allowing manual control over these parameters?

If we use the navigator context provider to set the userAgent and referrer as suggested by @samisayegh , then I don't think there would be any need to allow further manual control over these parameters. The implementer could have complete control over them by passing a custom navigatorContextProvider when initializing the engine.

Base automatically changed from KIT-3335 to master June 25, 2024 17:36
@Spuffynism
Copy link
Contributor Author

Re-requesting reviews since I've changed the approach to use the navigator context across commerce requests to fetch the user agent and referrer!

Copy link
Contributor

@samisayegh samisayegh left a comment

Choose a reason for hiding this comment

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

@Spuffynism Spuffynism changed the title fix(commerce): populate context.user.userAgent with relay fix(commerce): populate context.user.userAgent with navigatorContext Jun 26, 2024
@Spuffynism Spuffynism added this pull request to the merge queue Jun 26, 2024
@Spuffynism Spuffynism removed this pull request from the merge queue due to a manual request Jun 26, 2024
@Spuffynism Spuffynism added this pull request to the merge queue Jun 27, 2024
Merged via the queue into master with commit 0dc9434 Jun 27, 2024
91 of 92 checks passed
@Spuffynism Spuffynism deleted the fix-capi-1091-populate-user-agent branch June 27, 2024 13:20
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.

5 participants