Repository navigation
FOUR-30918: [Phase 1] tasksPageEtag, Improve task Loading, indexOptimized method to taskController api-1.1 #8981
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
Open
pmPaulis
wants to merge
22
commits into
develop
Choose a base branch
from
epic/FOUR-30918-without-octane
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
b607dd8
feat: implement ETag middleware for Tasks page caching
devmiguelangel 5ecf0f4
feat: update inbox and tasks routes to use ETag middleware for improv…
devmiguelangel 8677dab
feat: enhance BrowserCache middleware to return response if ETag head…
devmiguelangel 89c0183
test: add ETag handling tests for Tasks page to ensure proper caching…
devmiguelangel 34bb989
feat: optimize TasksPageEtag for permission handling and user configu…
devmiguelangel c4f7e1f
fix: update inbox route to use no-cache middleware for improved respo…
devmiguelangel fd5cebc
docs: add Tasks Page ETag Sequence documentation
devmiguelangel 9cf4563
feat: add api client caching functionality
devmiguelangel 7b3f11f
feat: add debug logging to api client cache for improved diagnostics
devmiguelangel dfc6091
feat(FOUR-31831): review Improve Task page loading
rodriquelca 40fc24a
fix: code style
rodriquelca e01a75f
feat: enhance api client cache with additional utility functions and …
devmiguelangel 93f4e68
feat: return original request in api client cache to maintain promise…
devmiguelangel 4489b89
test: add comprehensive tests for api client cache functionality
devmiguelangel cb592e8
Adding indexOptimized method to taskController api-1.1
AugustoLopezProcess 4ee7901
Adding optimization parameter to nonSystem
AugustoLopezProcess a5ce0c5
Adding taskOptimized route to api.php v1.1
AugustoLopezProcess e4a1759
Adding indexOptimizedBaseQuery method
AugustoLopezProcess 8a510a9
Adding config value from env, to activate the optimized endpoint on 1.1
AugustoLopezProcess dc4c244
fix: merge conflicts
rodriquelca 2bceead
Merge remote-tracking branch 'origin/develop' into epic/FOUR-30918-wi…
devmiguelangel 6e18d74
fix: drop mix preloads from vite task edit view
devmiguelangel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <?php | ||
|
|
||
| namespace ProcessMaker\Http\Middleware\Etag; | ||
|
|
||
| use Closure; | ||
| use Illuminate\Http\Request; | ||
| use ProcessMaker\Http\Resources\Caching\TasksPageEtag as TasksPageEtagResource; | ||
| use Symfony\Component\HttpFoundation\Response; | ||
|
|
||
| class TasksPageEtag | ||
| { | ||
| public function __construct( | ||
| private TasksPageEtagResource $tasksPageEtag | ||
| ) { | ||
| } | ||
|
|
||
| /** | ||
| * Handle Tasks page validation before rendering the full page shell. | ||
| * | ||
| * The ETag is computed from stable page context before controller execution, so a | ||
| * matching conditional request can return 304 without paying the render cost. | ||
| */ | ||
| public function handle(Request $request, Closure $next): Response | ||
| { | ||
| if (!config('etag.enabled') || (!$request->isMethod('GET') && !$request->isMethod('HEAD'))) { | ||
| return $next($request); | ||
| } | ||
|
|
||
| $etag = $this->tasksPageEtag->getEtag($request); | ||
|
|
||
| if ($this->buildResponseWithEtag($etag)->isNotModified($request)) { | ||
| return $this->withPrivateCacheHeaders($this->buildNotModifiedResponse($etag, $request)); | ||
| } | ||
|
|
||
| $response = $next($request); | ||
| $response->setEtag($etag); | ||
|
|
||
| return $this->withPrivateCacheHeaders($response); | ||
| } | ||
|
|
||
| /** | ||
| * Build a framework-compatible 304 response for a matched Tasks page ETag. | ||
| */ | ||
| private function buildNotModifiedResponse(string $etag, Request $request): Response | ||
| { | ||
| $response = $this->buildResponseWithEtag($etag); | ||
| $response->isNotModified($request); | ||
|
|
||
| return $response; | ||
| } | ||
|
|
||
| /** | ||
| * Create a response carrying the Tasks page validator. | ||
| * | ||
| * Weak ETags are used because the HTML may be transformed by gzip while the | ||
| * rendered representation remains equivalent for browser revalidation. | ||
| */ | ||
| private function buildResponseWithEtag(string $etag): Response | ||
| { | ||
| $response = new Response(); | ||
| $response->setEtag($etag, true); | ||
|
|
||
| return $response; | ||
| } | ||
|
|
||
| /** | ||
| * Apply browser-cache headers that allow private conditional revalidation. | ||
| */ | ||
| private function withPrivateCacheHeaders(Response $response): Response | ||
| { | ||
| $response->headers->set('Cache-Control', 'private, must-revalidate'); | ||
| $response->headers->remove('Pragma'); | ||
| $response->headers->remove('Expires'); | ||
|
|
||
| return $response; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.