Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

@nikhilsaikethe nikhilsaikethe commented Sep 25, 2025

PR Type

Bug fix


Description

  • Show parent when children visible

  • Filter rows by show before render

  • Update empty/loading checks to filtered rows

  • Limit items-size and rows to filtered data


Diagram Walkthrough

flowchart LR
  EditRole["EditRole.vue: set permission.show when children exist"]
  PermissionsTable["PermissionsTable.vue: compute filtered rows"]
  UI["UI: render/empty states use filtered rows"]
  EditRole -- "propagate show to parent" --> PermissionsTable
  PermissionsTable -- "use getFilteredRows" --> UI
Loading

File Walkthrough

Relevant files
Bug fix
EditRole.vue
Ensure parent permission shows when children visible         

web/src/components/iam/roles/EditRole.vue

  • Set permission.show = true when filteredEntities exist
  • Move show assignment before entity slicing
  • Preserve entity slicing for specific permissions
  • Clear temporary filteredEntities after processing
+4/-4     
PermissionsTable.vue
Render only visible rows via computed filter                         

web/src/components/iam/roles/PermissionsTable.vue

  • Add getFilteredRows computed to filter by row.show
  • Replace rows with getFilteredRows across template
  • Update empty and resource messages to use filtered length
  • Import computed and defineEmits
+11/-7   

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Sep 25, 2025
@github-actions github-actions bot changed the title fix: streams list render issue main fix: streams list render issue main Sep 25, 2025
@github-actions
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Side Effects

Mutating permission.show inside visibility update may have unintended UI side effects if other logic assumes parent visibility is solely user-driven; confirm this aligns with UX and does not override explicit hides.

if (filteredEntities?.length) {
  permission.show = true;
}
Null Safety

getFilteredRows accesses props.rows.filter(...); ensure props.rows is always an array to avoid runtime errors when undefined or null. Consider defaulting to an empty array.

const getFilteredRows = computed(() => {
  return props.rows.filter((row) => row?.show);
})
Double Binding

Both :items and :rows are set to the same computed list; verify the component expects both to be provided and that duplication won’t cause redundant rendering or mismatched pagination/virtual scroll behavior.

:items="getFilteredRows"
flat
bordered
ref="permissionsTableRef"
:rows="getFilteredRows"
:columns="columns as []"

@github-actions
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Null-safe rows filtering

Add a null-safe fallback and type check when filtering props.rows to prevent runtime
errors if it is undefined or not an array. This ensures the component renders
without crashing during async updates or prop changes.

web/src/components/iam/roles/PermissionsTable.vue [375-377]

 const getFilteredRows = computed(() => {
-  return props.rows.filter((row) => row?.show);
-})
+  const rows = Array.isArray(props.rows) ? props.rows : [];
+  return rows.filter((row) => row?.show);
+});
Suggestion importance[1-10]: 7

__

Why: Adding an Array.isArray guard prevents runtime errors if props.rows is undefined or not an array during async prop updates, aligning with other template usages of getFilteredRows.

Medium
Safely check filtered length

Guard against getFilteredRows being undefined in edge cases to avoid runtime errors
when accessing .length. Use optional chaining with a fallback to ensure the
condition remains safe. This prevents template evaluation crashes if rows is
momentarily undefined or not an array.

web/src/components/iam/roles/PermissionsTable.vue [33-39]

 <div
   data-test="edit-role-permissions-table-no-permissions-title"
-  v-if="!level && !getFilteredRows.length"
+  v-if="!level && !(getFilteredRows?.length || 0)"
   class="w-full text-center q-mt-lg text-bold text-grey-9"
   style="margin-top: 64px; font-size: 18px"
 >
   <span> No Permissions Selected </span>
 </div>
Suggestion importance[1-10]: 4

__

Why: Using optional chaining in the template is a minor safety improvement, but getFilteredRows is a computed that should always be defined; addressing undefined here is low-impact and may be unnecessary if suggestion 2 is applied.

Low
General
Reset visibility when empty

Ensure permission.show is explicitly set to false when there are no filtered
entities to avoid stale truthy state from previous updates. This keeps visibility
consistent with the current filteredEntities.

web/src/components/iam/roles/EditRole.vue [1183-1186]

 if (filteredEntities?.length) {
   permission.show = true;
+} else {
+  permission.show = false;
 }
Suggestion importance[1-10]: 6

__

Why: Explicitly setting permission.show = false when filteredEntities is empty prevents stale visibility states; it's reasonable given the logic but not strictly necessary if other conditions later overwrite permission.show.

Low

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR fixes a streams list rendering issue in the IAM role permissions interface. The fix involves two key changes:

EditRole.vue: Moves the parent visibility check (permission.show = true) to execute before stream-specific rendering logic, ensuring parent resources are properly shown when their filtered entities have content.

PermissionsTable.vue: Replaces raw rows array usage with a computed getFilteredRows property that filters by row?.show, improving the accuracy of display conditions and virtual scroll rendering.

These changes address a rendering bug where parent resources weren't being displayed correctly when child entities were filtered, particularly affecting the streams list in the permissions table.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are focused, well-targeted bug fixes that improve UI rendering logic without introducing side effects. Both changes follow Vue best practices and address a specific rendering issue with clear, logical solutions.
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
web/src/components/iam/roles/EditRole.vue 5/5 Fixed parent visibility logic by moving filteredEntities check before stream-specific rendering logic
web/src/components/iam/roles/PermissionsTable.vue 5/5 Improved table rendering by using filtered rows instead of raw rows for display conditions

Sequence Diagram

sequenceDiagram
    participant User
    participant EditRole as EditRole.vue
    participant PermissionsTable as PermissionsTable.vue
    participant API as Backend API

    Note over User,API: Streams List Render Issue Fix

    User->>EditRole: Load role permissions
    EditRole->>API: Fetch role data and resources
    API-->>EditRole: Return role permissions and resources
    
    Note over EditRole: updatePermissionVisibility() called
    
    EditRole->>EditRole: Check filteredEntities.length
    alt filteredEntities has content
        EditRole->>EditRole: Set permission.show = true (moved earlier)
        Note over EditRole: Fix ensures parent resources shown<br/>when children are filtered
    end
    
    EditRole->>EditRole: Apply stream-specific logic
    Note over EditRole: logs, metrics, traces, index handling
    
    EditRole->>PermissionsTable: Pass filtered permissions
    
    Note over PermissionsTable: Template rendering improvements
    
    PermissionsTable->>PermissionsTable: getFilteredRows computed property
    Note over PermissionsTable: Uses rows.filter(row => row?.show)<br/>instead of raw rows array
    
    PermissionsTable->>PermissionsTable: Update display conditions
    Note over PermissionsTable: v-if="!getFilteredRows.length"<br/>instead of v-if="!rows.length"
    
    PermissionsTable->>PermissionsTable: Update virtual scroll items
    Note over PermissionsTable: :items="getFilteredRows"<br/>:items-size="getFilteredRows.length"
    
    PermissionsTable-->>User: Render correctly filtered permissions table
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nikhilsaikethe nikhilsaikethe force-pushed the streams-list-render-issue-main branch from 9cc1e95 to aef6ed3 Compare September 26, 2025 05:55
@nikhilsaikethe nikhilsaikethe force-pushed the streams-list-render-issue-main branch from 358c6b4 to 06d8a6a Compare September 26, 2025 12:16
@nikhilsaikethe nikhilsaikethe merged commit 5a51e28 into main Sep 26, 2025
29 checks passed
@nikhilsaikethe nikhilsaikethe deleted the streams-list-render-issue-main branch September 26, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants