Skip to content

feat(category): cascade-select category tree via folder icon - #707

Merged
navneetkumar-pim-webkul merged 4 commits into
unopim:3.xfrom
vipinkutthi-webkul:feat/category-tree-folder-select
Sep 15, 2026
Merged

navneetkumar-pim-webkul merged 4 commits into
unopim:3.xfrom
vipinkutthi-webkul:feat/category-tree-folder-select

Conversation

@vipinkutthi-webkul

Copy link
Copy Markdown
Contributor

No description provided.

Clicking a category's folder icon in the product-edit category tree and
the datagrid category filter now selects (or deselects) that category
together with every descendant in one action, instead of requiring each
subcategory to be ticked individually. The cascade resolves through a
single nested-set query regardless of branch depth, guarded against
oversized subtrees and against radio-input/navigate-on-select tree
usages where a cascading select doesn't apply.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical rendering and cascade concurrency issues, plus subtree synchronization defects, remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds folder-icon cascade selection for category trees, backed by a bounded descendant endpoint.

Changes:

  • Adds descendant retrieval with a 5,000-node limit.
  • Updates tree cascade selection and unsaved-change tracking.
  • Adds localized messages and changelog documentation.
File summaries
File Description
packages/Webkul/Category/src/Repositories/CategoryRepository.php Adds descendant counting and tree retrieval.
packages/Webkul/Admin/src/Routes/catalog-routes.php Registers the descendants endpoint.
packages/Webkul/Admin/src/Resources/views/components/tree/item.blade.php Implements folder cascade behavior.
packages/Webkul/Admin/src/Resources/views/components/tree/category/view.blade.php Configures the endpoint and dirty tracking.
packages/Webkul/Admin/src/Resources/views/catalog/products/edit/categories.blade.php Enables category unsaved-change tracking.
packages/Webkul/Admin/src/Resources/lang/zh_TW/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/zh_CN/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/vi_VN/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/uk_UA/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/tr_TR/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/tl_PH/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/sv_SE/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/ru_RU/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/ro_RO/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/pt_PT/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/pl_PL/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/no_NO/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/nl_NL/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/mn_MN/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/ko_KR/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/ja_JP/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/it_IT/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/id_ID/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/hr_HR/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/hi_IN/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/fr_FR/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/fi_FI/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/es_VE/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/es_ES/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/en_US/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/en_NZ/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/en_GB/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/en_AU/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/de_DE/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/da_DK/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/ca_ES/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Resources/lang/ar_AE/app.php Adds localized overflow messaging.
packages/Webkul/Admin/src/Http/Requests/CategoryDescendantsForm.php Validates and authorizes descendant requests.
packages/Webkul/Admin/src/Http/Controllers/Catalog/CategoryController.php Serves bounded descendant trees.
CHANGELOG.md Documents the feature.
Review details

Suppressed comments (3)

packages/Webkul/Admin/src/Resources/views/components/tree/item.blade.php:560

  • The cascade mutates children and immediately emits change-input, but the newly fetched descendant components do not mount (and therefore do not register their labels) until Vue's next render. v-product-categories.onTreeSelection() snapshots this.$refs.tree.labels during this event, so the newly selected codes are missing from labelByCode and the category summary falls back to a count until another selection event occurs. Wait for the render tick before emitting, or register the fetched labels directly.
    packages/Webkul/Admin/src/Resources/views/components/tree/item.blade.php:617
  • The recursive sync also visits leaf nodes. For a mounted leaf, children is empty, so setting hasFetchedChildren and showChildren here gives it a chevron and an empty expandable branch after a parent cascade. Only synchronize mounted descendants when children.length is non-zero.
    packages/Webkul/Admin/src/Resources/views/components/tree/item.blade.php:571
  • This request sends only the category id, while the initial product category tree explicitly requests the active channel locale (categories.blade.php:268). CategoryTreeResource resolves labels from the request locale and otherwise uses the global requested locale, so when the editor falls back to a channel's first locale the newly fetched subtree can switch languages. Pass the active locale through this component and validate/use it in the descendants request.
  • Files reviewed: 41/41 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/Webkul/Admin/src/Resources/views/components/tree/item.blade.php Outdated
Comment thread packages/Webkul/Admin/src/Resources/views/components/tree/item.blade.php Outdated
…es, and stale locale

- Add tree-wide cascadeInFlight guard so rapid folder clicks can't overlap
- Guard leaf nodes from being marked expandable after a cascade fetch
- Pass locale through to the descendants endpoint and resolve names in it
- Add a11y: role="button", tabindex, aria-label, Enter/Space on folder icon
- Await nextTick before emitting select-node/change-input so labels are ready
- Add declare(strict_types=1) to CategoryDescendantsForm
- Add descendants-endpoint test coverage: full subtree, locale, auth, 422 cap
@navneetkumar-pim-webkul
navneetkumar-pim-webkul merged commit 5910fe2 into unopim:3.x Sep 15, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants