Skip to content

feat: add keepComponentAlive to all 4 framework Row Detail plugins#2653

Open
ghiscoding wants to merge 9 commits into
masterfrom
bugfix/row-detail-rendering-fixes
Open

feat: add keepComponentAlive to all 4 framework Row Detail plugins#2653
ghiscoding wants to merge 9 commits into
masterfrom
bugfix/row-detail-rendering-fixes

Conversation

@ghiscoding

@ghiscoding ghiscoding commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Adds keepComponentAlive option to preserve row detail component state when scrolling

fixes #2651

Why Opt-In?

By default, row detail components are destroyed and recreated when scrolling out of viewport. This is memory-efficient for large datasets. However, this destroys component state (form input, nested grid filters, scroll position, etc.).

The new keepComponentAlive flag enables keeping components alive in memory so state is preserved. It's opt-in by default (false) to maintain backward compatibility and avoid unexpected memory overhead for existing applications with large datasets.

Changes

  • Added keepComponentAlive?: boolean option to RowDetailViewOption interface
  • Implemented keep-alive feature across all 4 framework row detail plugins:
    • Angular: Uses ApplicationRef.detachView() and attachView()
    • Aurelia: Detaches/reattaches slots from DOM
    • React: Persists container element for root re-render
    • Vue: Stores component instance and reattaches to fresh container
  • Added UI toggle to Example45 demos in all 4 frameworks
  • Updated comprehensive documentation in all 5 row-detail.md files
  • Fixed critical bug: rowDetailViewOptions getter now reads from getOptions() instead of stale gridOptions.rowDetailView
  • Refactored Vue implementation to use tryCatchWithReturn utility for consistent error handling
  • Push a fix to properly detect when Row Detail comes back to viewport visible range

Use Cases

Enable keepComponentAlive when you need to preserve component state:

  • Nested grids with active filters/sort
  • Forms with user input that shouldn't be lost
  • Components with expensive initialization
  • Long scroll lists where re-render cost is significant

Trade-offs

  • Memory: Components stay in memory; impacts large datasets with many expanded rows
  • Performance: Avoids re-render cost when scrolling back; negligible overhead if few rows expanded
  • Graceful fallback: If reattach fails, automatically falls back to fresh re-render

References

Related to discussion: Row Detail Plugin - Official approach for rendering Angular components in v10.x (standalone)? · ghiscoding/slickgrid-universal · Discussion #2651

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (7d3e7d8) to head (b54a7e7).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2653   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         200      200           
  Lines       25325    25330    +5     
  Branches     8954     8954           
=======================================
+ Hits        25325    25330    +5     
Flag Coverage Δ
angular 100.0% <ø> (ø)
universal 100.0% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown
angular-slickgrid

npm i https://pkg.pr.new/angular-slickgrid@2653

aurelia-slickgrid

npm i https://pkg.pr.new/aurelia-slickgrid@2653

slickgrid-react

npm i https://pkg.pr.new/slickgrid-react@2653

slickgrid-vue

npm i https://pkg.pr.new/slickgrid-vue@2653

@slickgrid-universal/angular-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/angular-row-detail-plugin@2653

@slickgrid-universal/aurelia-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/aurelia-row-detail-plugin@2653

@slickgrid-universal/react-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/react-row-detail-plugin@2653

@slickgrid-universal/vue-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/vue-row-detail-plugin@2653

@slickgrid-universal/binding

npm i https://pkg.pr.new/@slickgrid-universal/binding@2653

@slickgrid-universal/common

npm i https://pkg.pr.new/@slickgrid-universal/common@2653

@slickgrid-universal/composite-editor-component

npm i https://pkg.pr.new/@slickgrid-universal/composite-editor-component@2653

@slickgrid-universal/custom-footer-component

npm i https://pkg.pr.new/@slickgrid-universal/custom-footer-component@2653

@slickgrid-universal/custom-tooltip-plugin

npm i https://pkg.pr.new/@slickgrid-universal/custom-tooltip-plugin@2653

@slickgrid-universal/empty-warning-component

npm i https://pkg.pr.new/@slickgrid-universal/empty-warning-component@2653

@slickgrid-universal/event-pub-sub

npm i https://pkg.pr.new/@slickgrid-universal/event-pub-sub@2653

@slickgrid-universal/excel-export

npm i https://pkg.pr.new/@slickgrid-universal/excel-export@2653

@slickgrid-universal/graphql

npm i https://pkg.pr.new/@slickgrid-universal/graphql@2653

@slickgrid-universal/odata

npm i https://pkg.pr.new/@slickgrid-universal/odata@2653

@slickgrid-universal/pagination-component

npm i https://pkg.pr.new/@slickgrid-universal/pagination-component@2653

@slickgrid-universal/pdf-export

npm i https://pkg.pr.new/@slickgrid-universal/pdf-export@2653

@slickgrid-universal/row-detail-view-plugin

npm i https://pkg.pr.new/@slickgrid-universal/row-detail-view-plugin@2653

@slickgrid-universal/rxjs-observable

npm i https://pkg.pr.new/@slickgrid-universal/rxjs-observable@2653

@slickgrid-universal/sql

npm i https://pkg.pr.new/@slickgrid-universal/sql@2653

@slickgrid-universal/text-export

npm i https://pkg.pr.new/@slickgrid-universal/text-export@2653

@slickgrid-universal/utils

npm i https://pkg.pr.new/@slickgrid-universal/utils@2653

@slickgrid-universal/vanilla-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-bundle@2653

@slickgrid-universal/vanilla-force-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-force-bundle@2653

@slickgrid-universal/web-mcp

npm i https://pkg.pr.new/@slickgrid-universal/web-mcp@2653

commit: b54a7e7

@ghiscoding

ghiscoding commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

@jr01 this might interest you since I know you are a user of Row Detail with Angular-Slickgrid... for reference, I asked copilot to see if the discussion opened in #2651 is fixable and this PR tries to fix those concerns by adding a new flag keepComponentAlive (I barely provided guidance to copilot).

So I wouldn't mind your feedback on this PR if you have any special thoughts. Thanks

@ghiscoding ghiscoding changed the title feat: add keepComponentAliveOnOutOfViewport to row detail plugin feat: add keepComponentAlive to row detail plugin Jul 20, 2026
@ghiscoding ghiscoding changed the title feat: add keepComponentAlive to row detail plugin feat: add keepComponentAlive to all frameworks Row Detail plugins Jul 20, 2026
@ghiscoding ghiscoding changed the title feat: add keepComponentAlive to all frameworks Row Detail plugins feat: add keepComponentAlive to all 4 framework Row Detail plugins Jul 20, 2026
@jr01

jr01 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks @ghiscoding ), this looks really great!! I think the opt-in default is exactly right: it solves the RowDetail state-loss problem while preserving the existing memory-efficient behavior for large grids.

I also like that an explicit collapse still destroys the component, and the viewport re-entry edge-case handling and regression tests. This gives us a clean path to use stateful RowDetail components (nested grids, forms, expensive initialization) without workarounds.

No blockers from my side. Great work, and thanks! 💯 🥇 Looking forward to applying this.

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.

2 participants