Add custom fetch injection to FetchHttpClient for Next.js caching #5101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Automated Changes by SimulateDev
Setup
Task
Add custom fetch injection capability to FetchHttpClient to enable Next.js caching support while maintaining backward compatibility.
Coding agents used
Execution time
⏱️ 13m 32.2s
Summary
This PR addresses issue #4922 by adding the ability to inject a custom fetch implementation into the FetchHttpClient. The new
layerWithFetch
function allows developers to provide their own fetch implementation, enabling the use of Next.js's patched fetch and its caching capabilities. The changes maintain full backward compatibility while providing a clean API for custom fetch injection. Implementation was completed using Cursor IDE with Claude-4-Sonnet across planning, coding, and testing phases.What changed?
layerWithFetch
function topackages/platform/src/FetchHttpClient.ts
layerWithFetch
export inpackages/platform/src/internal/fetchHttpClient.ts
layer
exportReview Instructions
Please carefully review all changes before merging. While AI agents are powerful, human oversight is always recommended.
Generated by SimulateDev, the AI coding agents collaboration platform.