mirror of
https://gh.wpcy.net/https://github.com/elementor/elementor.git
synced 2026-06-18 04:33:19 +08:00
Add afterSettingsResolve hook on nested templated element views, thread currentPostId from renderContext through dynamic-transformer, and bucket dynamic tag cache requests by editorRenderPostId using the existing render_tags endpoint. Ref: ED-24339 ## PR Checklist <!-- Please check if your PR fulfills the following requirements: **Filling out the template is required.** Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. --> - [ ] The commit message follows our guidelines: https://github.com/elementor/elementor/blob/master/.github/CONTRIBUTING.md ## PR Type What kind of change does this PR introduce? <!-- Please check the one that applies to this PR using "x" with no spaces eg: [x]. --> - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, local variables) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] CI related changes - [ ] Documentation content changes - [ ] Other... Please describe: ## Summary This PR can be summarized in the following changelog entry: * ## Description An explanation of what is done in this PR * ## Test instructions This PR can be tested by following these steps: * ## Quality assurance - [ ] I have tested this code to the best of my abilities - [ ] I have added unittests to verify the code works as intended - [ ] Docs have been added / updated (for bug fixes / features) Fixes # <!--start_gitstream_placeholder--> ### ✨ PR Description ## 1. Problem & Context Nested templated elements in the editor canvas now need access to parent render context (e.g., current post ID) when resolving dynamic tags. This enables proper tag resolution across different post contexts within nested structures. ## 2. What Changed (Where) - **PHP (manager.php)**: Refactored access control from `User::is_current_user_can_edit()` to new `can_current_user_render_tags_for_post()` with fallback to post type capabilities. - **TypeScript (create-nested-templated-element-type.ts)**: Added `afterSettingsResolve()` hook to process resolved settings before caching. - **TypeScript (create-component-type.ts)**: Enhanced `getResolverRenderContext()` to merge parent resolver context with component's own namespace context. - **TypeScript (dynamic-transformer.ts)**: Threaded `renderContext.currentPostId` through dynamic tag resolution pipeline. - **JavaScript (manager.js)**: Restructured cache requests to bucket by `editorRenderPostId` per tag, enabling multi-post batch renders with per-post AJAX calls. - **Types (types.ts)**: Removed `RefreshCacheFromServerOptions`; added `editorRenderPostId` to `TagInstance`. - **Tests**: Full coverage for manager bucketing and batch request logic. ## 3. How It Works Render context flows top-down: parent component → `getResolverRenderContext()` → merged with child namespace → passed to dynamic tag transformer. Tags now carry `editorRenderPostId` override; cache layer groups pending requests by post ID, fires separate AJAX calls per bucket, then consolidates results. `afterSettingsResolve()` hook allows intermediate processing before hash comparison. ## 4. Risks Post ID bucketing changes cache key generation—ensure old cached entries don't collide with new scheme. Batch ID logic (`needsUniqueIds`) assumes `postIds.length > 1` distinguishes parallel vs. single renders; verify no race conditions if callbacks fire out-of-order during concurrent requests. _Generated by LinearB AI and added by gitStream._ <sub>AI-generated content may contain inaccuracies. Please verify before using. 💡 **Tip:** You can customize your AI Description using **Guidelines** [Learn how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub> <!--end_gitstream_placeholder--> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: IshayMaya <47317545+IshayMaya@users.noreply.github.com> Co-authored-by: ElementorBot <48412871+elementorbot@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| admin | ||
| app | ||
| base | ||
| behaviors/interfaces | ||
| breakpoints | ||
| common | ||
| database | ||
| debug | ||
| document-types | ||
| dynamic-tags | ||
| editor | ||
| experiments | ||
| files | ||
| frontend | ||
| isolation | ||
| kits | ||
| logger | ||
| page-assets | ||
| responsive | ||
| role-manager | ||
| settings | ||
| upgrade | ||
| utils | ||
| documents-manager.php | ||
| modules-manager.php | ||
| wp-api.php | ||