Skip to content

Conversation

@Seungwoo321
Copy link
Member

Summary

  • Optimized memory usage with shallowRef and toRaw
  • Removed unused test components and utilities
  • Cleaned up codebase

Changes

  • Use shallowRef in useMaterializeInput for better performance with large datasets
  • Add onUnmounted cleanup hooks to prevent memory leaks
  • Use toRaw() when creating PivotData to reduce reactivity overhead
  • Remove unused usePivotModelHistory and useDraggableMemoryFix
  • Clean up main.ts to use App.vue directly
  • Remove deep watch that was causing performance issues

Testing

  • Tested memory usage with large datasets
  • Verified no memory leaks in standard usage patterns
  • All functionality remains intact

Seungwoo321 and others added 8 commits August 11, 2025 18:34
- Fix memory leak in VPivottableUi by implementing proper PivotData memoization
- Replace inefficient watchEffect with controlled recreation based on structure changes
- Add deep cleanup to break circular references between PivotData and aggregators
- Fix renderer undefined error (Issue #269) by adding default TableRenderer
- Add null safety check for renderer access
- Optimize PivotData creation to only occur when essential properties change

Fixes #269, #270

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Enhanced aggregator cleanup to break all closure references
- Added markRaw to prevent reactivity on large data arrays
- Implemented component key cycling to prevent accumulation
- Deep cleanup of all PivotData properties including function closures
- Break circular references in row/col totals and allTotal aggregators

Expected: Memory usage should stay below 50MB after 750 refreshes
Previous: 466MB memory growth, now should be <50MB

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
**Root Cause Identified:**
- pivotDataKey only checked dataLength, not actual data changes
- Same length data (1000 records) resulted in no PivotData recreation
- Old data accumulated without cleanup for 800+ refreshes

**Fix:**
- Include actual data reference in pivotDataKey computation
- Now detects when new data array is generated (same length, different content)
- Forces PivotData recreation and cleanup on each refresh

**Expected Result:**
Memory should reset to baseline (~43MB) on each refresh instead of accumulating

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…umulation

**Root Cause Found:**
- JSON.stringify(dataReference) was creating massive string overhead (24MB → 1018MB)
- Component Key was fixed at 0, preventing component destruction/recreation
- Memory accumulated because same component instance reused indefinitely

**Solution:**
- Remove complex memoization logic that was causing string bloat
- Use simple computed(() => new PivotData(state)) for reactivity
- Force component recreation with :key="pivot-${refreshCount}"
- Each refresh destroys previous component and creates clean instance
- Clean up unused imports (shallowRef, watchEffect, onUnmounted)

**Expected Result:**
Memory should stay stable around baseline instead of accumulating

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unnecessary test files and move to project root
- Optimize useMaterializeInput with shallowRef for large data
- Add proper cleanup in onUnmounted hooks
- Use toRaw() in PivotData creation to reduce reactivity overhead
- Remove unused usePivotModelHistory and useDraggableMemoryFix
- Simplify main.ts to use App.vue directly
- Remove deep watch to prevent performance issues
Fixed undefined SimpleApp reference to use App component.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Seungwoo321 Seungwoo321 merged commit b4bd857 into develop Aug 12, 2025
2 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.

1 participant