Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const toolbarOptions = computed(() => {
}
if (!showToolbar.value) {
toolbarConfig.enabled = false;
return { toolbarConfig };
Comment on lines 167 to 169
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n packages/effects/plugins/src/vxe-table/use-vxe-grid.vue | head -200

Repository: vbenjs/vue-vben-admin

Length of output: 6563


🏁 Script executed:

# Get more context around lines 167-169 to verify the complete logic
sed -n '140,180p' packages/effects/plugins/src/vxe-table/use-vxe-grid.vue | cat -n

Repository: vbenjs/vue-vben-admin

Length of output: 1579


Avoid disabling toolbar when tools are configured.

showToolbar only checks for slots and table title, ignoring toolbarConfig.tools. When users provide tools via gridOptions.toolbarConfig.tools but without any toolbar slots or table title, the toolbar gets disabled despite having configured content, hiding user actions and the search toggle. Gate the disable on actual toolbar content.

🔧 Proposed fix (guard with tools presence)
-  if (!showToolbar.value) {
+  const hasToolbarContent =
+    showToolbar.value ||
+    (Array.isArray(toolbarConfig.tools) && toolbarConfig.tools.length > 0);
+
+  if (!hasToolbarContent) {
     toolbarConfig.enabled = false;
     return { toolbarConfig };
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!showToolbar.value) {
toolbarConfig.enabled = false;
return { toolbarConfig };
const hasToolbarContent =
showToolbar.value ||
(Array.isArray(toolbarConfig.tools) && toolbarConfig.tools.length > 0);
if (!hasToolbarContent) {
toolbarConfig.enabled = false;
return { toolbarConfig };
🤖 Prompt for AI Agents
In `@packages/effects/plugins/src/vxe-table/use-vxe-grid.vue` around lines 167 -
169, The current early return disables the toolbar whenever showToolbar.value is
false, which misses cases where toolbarConfig.tools (from
gridOptions.toolbarConfig.tools) contains user-provided tools; update the guard
in use-vxe-grid (where showToolbar and toolbarConfig are used) to only disable
the toolbar if there is truly no content — i.e., check both showToolbar.value
and that toolbarConfig.tools is empty/undefined before setting
toolbarConfig.enabled = false and returning; ensure the logic references
toolbarConfig.tools (and gridOptions.toolbarConfig.tools) so configured tools
keep the toolbar visible.

}
Expand Down
Loading