- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 751
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: now hydration event is being returned if revision does not exist in cache #9203
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@sjaanus, core features have been modified in this pull request. Please review carefully! |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
], | ||
}); | ||
|
||
const { body: rehydrationBody } = await app.request |
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.
We are sending 1, which does not exist in cache.
@@ -12,6 +12,22 @@ export class DeltaCache { | |||
constructor(hydrationEvent: DeltaHydrationEvent, maxLength: number = 20) { | |||
this.hydrationEvent = hydrationEvent; | |||
this.maxLength = maxLength; | |||
|
|||
this.addBaseEventFromHydration(hydrationEvent); |
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.
This is important change. Previously when we were initializing environment, we just filled hydration event. But hydration event changes in time, so we also need to add an event with same revision id as base event to event queue.
This way if customer got hydration with rev 100, and hydration now moves to 101, customer is coming back with 100, we need to have reference to 100.
const delta = this.delta[environment]; | ||
if ( | ||
requiredRevisionId === 0 || | ||
delta.isMissingRevision(requiredRevisionId) |
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.
If delta is missing revision, return hydration.
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.
LGTM
Now when customer is coming with revision ID that does not exist in cache, we return hydration.