equinor / equinor/fusion-framework
Add React 17 deprecation warnings for Phase 1
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 10
- Avg merge
- 19h 40m
- Merged PRs (30d)
- 150
Description
## Description
Implement Phase 1 of the React 18 migration: Add deprecation warnings when React 17 is detected, while maintaining backward compatibility. This allows for a smoother transition with a minor version bump.
## Implementation Approach
### Runtime Detection
Add code to detect React version at runtime and warn users:
```typescript
import { version } from 'react';
if (version.startsWith('17.')) {
console.warn(
'⚠️ Fusion Framework: React 17 support is deprecated. ' +
'Please upgrade to React 18+ for continued support. ' +
'See migration guide: [link]'
);
}
```
### Warning Locations
1. **Main entry points**: Add warnings in framework initialization
2. **Render functions**: Warn when using deprecated renderComponent/renderApp
3. **Development mode only**: Only show warnings in development
### Phase 1 Goals
- Maintain backward compatibility with React 17
- Clearly communicate deprecation timeline
- Provide migration guidance
- Allow gradual adoption
## Implementation Steps
1. Add React version detection utility
2. Add deprecation warnings to key entry points
3. Update error messages with migration links
4. Test warnings appear in React 17 environments
5. Ensure no warnings in React 18+ environments
## Files to Update
- `packages/react/app/src/index.ts` (main entry point)
- `packages/react/framework/src/index.ts`
- Create version detection utility
- Update any existing deprecation warnings
## Testing
- Test with React 17 - warnings should appear
- Test with React 18 - no warnings should appear
- Test in production builds (warnings should not appear)
- Verify warning messages are helpful and actionable
## Future
This Phase 1 approach allows users time to migrate before Phase 2 removes React 17 support entirely.
## Labels
👾 React, 🚀 feature
Contributor guide
Research direction
Start by reading packages/react/app/src/index.ts and packages/react/framework/src/index.ts, then inspect any existing deprecation warnings and the framework initialization and render entry points. Verify the version detection approach against the React 17 and React 18 test environments, including production builds. Done means React 17 warns at the specified locations while React 18+ and production builds do not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100