-
Notifications
You must be signed in to change notification settings - Fork 39
demo(product-list): implement third-party data enrichment for Coveo products #6162
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
base: main
Are you sure you want to change the base?
Conversation
Pull Request ReportPR Title❌ Title should follow the conventional commit spec: Example: Live demo linksBundle Size
|
772604e to
fccb725
Compare
fccb725 to
0a06fe8
Compare
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| export enum Availability { | ||
| High = 'high', | ||
| Medium = 'medium', | ||
| Low = 'low', | ||
| OutOfStock = 'out-of-stock', | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"
No description provided.