Repository navigation
fix: system role member list display #8287
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
Merged
+25
−0
Merged
Changes from all commits
Commits
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the diff
Correctness / potential issues
column.type === 'selection'assumption is fragile. Withspan-method, Element Plus still renders one selection checkbox per row, but merged rows get[0, 0], so hidden checkboxes disappear. The header "select all" and the internal selection state then no longer map 1:1 to visible checkboxes. Verify thatselection-group-key="user_id"+ span merging yields the intended UX (e.g., selecting a merged row selects only the first visually rendered row). Relying oncolumn.type === 'selection'instead ofcolumn.propertyis correct for the checkbox column, but confirm it stays stable across Element Plus versions.Merge requires contiguous, sorted records.
objectSpanMethodmerges only consecutive rows with the sameuser_id. If the backend returns users interleaved (e.g., by role), you'll get multiple fragments per user and unstable spans. Ensure data ordering guarantees grouping, or sort client-side before rendering (but beware sorting interacts with server pagination).Pagination breaks the merge. Merging is computed from
members.valueonly, so a user spanning a page boundary will render as separate groups on each page. Acceptable, but worth documenting.Whole-table scan is O(n²) in the worst case. For every non-merged row the
whileloop re-scans forward. On large lists, this is repeated work. A single precomputed pass is cheaper:Then lookup by
rowIndexinobjectSpanMethod. Note: if you memoize, key it offmembersreactively (the computed does that) rather than calling inside the render function each time.Reactivity inside
span-method. Readingmembers.valueinside a render-time callback is fine since it's reactive, but the method is invoked frequently during table layout. The precomputed map above avoids repeated array access.row.user_idmay be undefined/null. Ifuser_idis missing,undefined === undefinedmerges all such rows together incorrectly. Add a guard:Signature duplication. The inline parameter type duplicates
TableColumnCtx<RoleMember>details; consider using the exported helper type forspan-methodparams (orTableSpanMethod) to avoid drift.Style / minor
shouldMergeexpression). Consider wrapping.while (...) rowspan += 1could use braces for readability.Summary
Logic is basically sound for contiguous, non-paginated groups. Main risks: interleaved/unordered data, pagination splits,
nulluser_id, and the check-all semantics of merged selection columns. Recommend replacing the per-row forward scan with a precomputed span map and adding guards.