-
Notifications
You must be signed in to change notification settings - Fork 26.5k
fix(common): skip transfer cache on client #55012
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
Conversation
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.
@Jefftopia thanks for creating the PR 👍
I've left a comment and also added @alan-agius4 as a reviewer to take a look at the change.
@Jefftopia one additional comment: I'd propose to change the commit message (via |
Hey @Jefftopia - Welcome :) |
6f8b48a
to
6dad001
Compare
6dad001
to
f62f423
Compare
f62f423
to
f02f848
Compare
@Jefftopia Its usually better to push additional commits up (instead of modifying the existing commit), so that its easier to see the changes from commit to commit. |
@sonukapoor oh hey 👋 Missed your comment before but I won't squash everything going forward, thanks. |
Thanks @Jefftopia Changes LGTM. Lets's wait for Alans input. |
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.
On the browser only adding to setting to the cache should be skipped
transferState.set<TransferHttpResponse>(storeKey, { |
As the current change will cause the cache not to be used at all which is undesired.
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.
Can you please amend the last 2 commits to use fixup!
IE: fixup! fix(common): skip transfer cache on client
42df598
to
a8d132a
Compare
done |
@Jefftopia thanks for updating the PR. It looks like there is still a second commit (with the "Merge branch 'main' of ..." commit message). Could you please rebase and update the branch to have just 1 commit with all changes? Thank you. |
@AndrewKushnir Edit: I went ahead and reset then rebased. Oof. |
@Jefftopia You could try to drop that commit and rebase again from main. |
0dbeb44
to
72a23c1
Compare
Done. |
Nice 👍 I usually use this git command to add a fixup commit: |
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.
🎉
@sonukapoor Yes, I used fixup for the commits addressing but you cannot fixup a merge commit ;-) Lesson learned for me -- you can only rebase on another branch to avoid merge commits. |
@alan-agius4 Thanks for your patience here. After "squashing" my merge commit, hydration specs failed. The PLATFORM_ID token was resolved as an InjectionToken object rather than a string. My latest push uses EnvironmentInjector again which contains the expected value in the hydration tests. I understand the interceptor has its own injection context but would be curious to know why that is to be preferred over environment injector for ![]() |
transfer cache interceptor should not run again on the client as it is intended for server to client handoff
222743e
to
6285c78
Compare
TestBed.configureTestingModule({ | ||
declarations: [SomeComponent], | ||
providers: [ | ||
{provide: PLATFORM_ID, useValue: 'browser'}, |
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.
Nit: Ideally we should be using PLATFORM_BROWSER_ID
instead of the browser
string. Same goes for the server string in the cases below.
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.
Looks like this has not been addressed.
Bump |
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
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, although technically the commit scope should be http and not common.
@@ -163,10 +165,12 @@ export function transferCacheInterceptorFn( | |||
); | |||
} | |||
|
|||
// Request not found in cache. Make the request and cache it. | |||
const isServer = isPlatformServer(inject(PLATFORM_ID)); |
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.
NIT: We could use isPlatformBrowser
here to avoid the additional symbol. (Couple of less bytes)
This PR was merged into the repository by commit 11705f5. |
transfer cache interceptor should not run again on the client as it is intended for server to client handoff PR Close #55012
transfer cache interceptor should not run again on the client as it is intended for server to client handoff PR Close angular#55012
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
transfer cache interceptor should not run again on the client as it is intended for server to client handoff
PR Type
What kind of change does this PR introduce?
What is the current behavior?
In rare instances, the transfer cache interceptor may execute on the client. While this does not appear to introduce problems, it is an unnecessary step.
Issue Number: #54444
What is the new behavior?
The transfer cache interceptor no longer performs caching behavior in the 'broswer' platform.
Does this PR introduce a breaking change?