Skip to content

Conversation

@louis-bompart
Copy link
Collaborator

No description provided.

@developer-experience-bot
Copy link
Contributor

developer-experience-bot bot commented Oct 15, 2025

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:
<type>(optional scope): <description>

Example: feat(headless): add result-list controller

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 255.6 255.6 0
commerce 369.4 369.4 0
search 427.1 427.1 0
insight 418.3 418.3 0
recommendation 266.4 266.4 0
ssr 421.5 421.5 0
ssr-commerce 386.5 386.5 0
ssr-commerce-next 387.8 387.8 0
ssr-next 422.1 422.1 0

@louis-bompart louis-bompart changed the title feat(product-list): implement third-party data enrichment for Coveo products demo(product-list): implement third-party data enrichment for Coveo products Oct 15, 2025
@louis-bompart louis-bompart force-pushed the demo/result-enrichment-ssr branch from 772604e to fccb725 Compare October 15, 2025 23:18
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AI alert for this; I used prop drillin' then asked Copilot to refactor this with a context.
If it smells, say so

* A fake 3rd party API that returns the availability of a product based on its id.
*
* The returned value of this fake API are random.
* The "response time" of the API is however rigged to illustrate various scenarios:
Copy link
Contributor

Choose a reason for hiding this comment

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

Intuitively, I'd say that in a real-life scenario you'd probably be able to fetch this information in a single batch (i.e., get availability status for all products in the result list). Otherwise you'd really be hammering the external service with requests.

With that in mind, we could still simulate latency, but it could just be:

  • 1st call -> optimistic
  • 2nd call -> normal
  • 3rd call -> slow, and reset

Copy link
Collaborator Author

@louis-bompart louis-bompart Oct 16, 2025

Choose a reason for hiding this comment

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

Intuitively, I'd say that in a real-life scenario you'd probably be able to fetch this information in a single batch (i.e., get availability status for all products in the result list). Otherwise you'd really be hammering the external service with requests.

With that in mind, we could still simulate latency, but it could just be:

  • 1st call -> optimistic
  • 2nd call -> normal
  • 3rd call -> slow, and reset

Yeah we could do that. The goal with my current approach is that you can see suspense in action in one page load.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand, but I wonder if there's any use in demonstrating that unless we can think of a more realistic / common use case. It seems to me like an API that would accept only one product at a time would be incredibly inefficient.

Comment on lines +13 to +18
export enum Availability {
High = 'high',
Medium = 'medium',
Low = 'low',
OutOfStock = 'out-of-stock',
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Realistically, product availability would more likely be a discrete number of units, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename the file to "product-availability-api-provider"

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