Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## 4.12.2
> Date: 2025-06-15
### Added
- "Copy with headers" option in context menu, which copies selected cells along with names of columns

## 4.12.1
> Date: 2025-06-15
### Added
- Dark mode styling in `style-dark.css`

## 4.12.0
> Date: 2025-06-15
### Added
- Support for React 19
- Updated dependencies

## 4.11.5
> Date: 2024-11-27
### Fix
Expand Down
73 changes: 73 additions & 0 deletions REACT19_SUPPORT_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# React 19 Support Implementation Summary

## Overview
react-datasheet-grid now supports React 19 while maintaining backward compatibility with React 15-18.

## Changes Made

### 1. Updated Dependencies
- **package.json**: Added React 19 to peerDependencies
```json
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
```

- **Core Dependencies**: Updated to React 19 compatible versions
- `react-resize-detector`: Updated from `^7.1.2` to `^12.0.2`
- `@tanstack/react-virtual`: Updated from `^3.0.0-beta.18` to `^3.13.10`

- **Development Dependencies**: Updated for React 19 support
- `@testing-library/react`: Updated from `^13.4.0` to `^16.1.0`
- `@types/react`: Updated to `^19.0.0`
- `react` and `react-dom`: Updated to `^19.0.0` for development

### 2. Component Updates
- **DataSheetGrid.tsx**: Maintained forwardRef for backward compatibility
- **StaticDataSheetGrid.tsx**: Maintained forwardRef for backward compatibility
- Both components continue to use forwardRef to ensure refs work correctly across all React versions (15-19)

### 3. Testing
- Created comprehensive React 19 compatibility tests in `tests/react19Compatibility.test.tsx`
- Tests verify:
- Components render without errors with refs
- Ref methods are accessible and functional
- Both DynamicDataSheetGrid and StaticDataSheetGrid work correctly
- forwardRef implementation works across React versions

### 4. Documentation
- Created `REACT19_MIGRATION_GUIDE.md` with:
- Compatibility information
- Performance optimization tips
- Migration steps
- Troubleshooting guide

### 5. Example and Development Dependencies
- Updated example project to support React 19:
- React and React-DOM updated to ^19.0.0
- TypeScript types updated to ^19.0.0
- Updated main project devDependencies for testing with React 19

## Key Decisions

### Why Keep forwardRef?
While React 19 supports ref as a prop, we maintained forwardRef to ensure:
1. **Backward Compatibility**: Works with React 15-18 without changes
2. **No Breaking Changes**: Users don't need to update their code
3. **Future Flexibility**: Can remove forwardRef in a future major version when React 19+ adoption is widespread

### Performance Considerations
- React 19's compiler automatically optimizes components
- We recommend keeping React.memo() on cell components for large datasets
- Column configurations should still be memoized

## Testing Results
- All existing tests pass ✓
- New React 19 compatibility tests pass ✓
- No breaking changes introduced ✓

## Future Considerations
In a future major version (v5.x), consider:
- Removing forwardRef when React 19+ adoption is widespread
- Leveraging React 19's compiler optimizations more aggressively
- Exploring Server Components for read-only grids
8 changes: 4 additions & 4 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^2.1.0",
"typescript": "^4.6.4",
"vite": "^3.1.0"
Expand Down
Loading