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(headless SSR): add hooks for ssr react commerce #4614

Merged
merged 6 commits into from
Nov 6, 2024
Merged

Conversation

y-lakhdar
Copy link
Contributor

TL;DR

Integration for server-side rendering with commerce functionalities. The changes include

  • Updates to the package exports
  • New react hooks
  • Creation of new types and hooks to facilitate SSR in commerce applications.

Key changes include:

Enhancements to SSR Support:

  • Added a new export for ./ssr-commerce in the package.json file. Implementer can now fetch all the goodies from the @coveo/headless-react/ssr-commerce

New Utilities and Hooks:

  • Created useEngine react hook.
  • Added utility functions for building controller hooks (e.g. useSearchBox, useFacetGenerator), engine hooks, and state providers to manage SSR and CSR contexts.
  • Added Static and Hydrated state providers for every solution types (search, listing, standalone).

Note
The controller hooks are programmatically generated based on the engine definition. You can find the logic in buildControllerHooks

Type Definitions:

  • Defined new types in types.ts to support the new SSR commerce functionalities, including ReactCommerceEngineDefinition, ContextState, and various hooks and state types.

https://coveord.atlassian.net/browse/KIT-3695

Copy link

github-actions bot commented Oct 31, 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 236.7 236.7 0
commerce 341.3 341.3 0
search 412.5 412.5 0
insight 401.8 401.8 0
recommendation 249 249 0
ssr 406.2 406.2 0
ssr-commerce 353.6 353.6 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 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
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

Base automatically changed from KIT-3694 to master October 31, 2024 16:48
@y-lakhdar y-lakhdar enabled auto-merge November 6, 2024 17:09
@y-lakhdar y-lakhdar added this pull request to the merge queue Nov 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 6, 2024
@y-lakhdar y-lakhdar added this pull request to the merge queue Nov 6, 2024
Merged via the queue into master with commit 7936561 Nov 6, 2024
116 checks passed
@y-lakhdar y-lakhdar deleted the KIT-3695 branch November 6, 2024 19:25
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.

3 participants