Upgrading from Yew 0.19 to 0.21 for maximum vibec0re performance ✨
yew:0.19→0.21yew-router:0.16→0.18gloo:0.8→0.11gloo-*crates: Various minor/major version bumps
-
Hook System Changes
- Hook positioning rules became stricter
- All hooks must be at function component top-level
- No conditional hook calls allowed
-
Router API Changes
use_historyhook removed/renamed- History management API restructured
- Route matching syntax updates
-
Event Handler Changes
- Event callback type system updated
- Some event types may have changed signatures
-
Component API Updates
- Function component macro changes
- Props system updates
- Context API modifications
- Update
Cargo.tomlwith new versions - Run
cargo updateto pull latest compatible versions - Document initial compilation errors
-
Authentication Component (
src/app/authenticate.rs)- Fix hook positioning violations (lines 57-59, 80-81)
- Move all
use_input_refcalls to component top-level - Restructure conditional logic to avoid hook positioning issues
-
Router Hooks (Multiple files)
- Replace
use_historywith new router API - Update imports in:
src/app/page.rssrc/app/authenticate.rssrc/app/router.rssrc/app/backends/page.rssrc/app/backends/list.rssrc/app/frontends/list.rssrc/app/frontends/page.rssrc/app/nav.rs
- Replace
- Client Hooks (
src/api/client.rs)- Update
use_client()to implement newHooktrait - Fix
client::State<T>to work with new hook system - Update
use_frontends()anduse_frontend()hooks - Ensure all custom hooks return
BoxedHook<'_, T>
- Update
- Form Components (
src/app/frontends/form.rs)- Fix
Callback<FocusEvent>vsSubmitEventtype mismatch - Update event handler signatures to match new API
- Review all form event bindings
- Fix
- Function Components
- Update component macro usage if needed
- Check for props system changes
- Validate context provider/consumer patterns
-
Route Definitions (
src/app/router.rs)- Update route syntax if changed
- Fix
use_routehook usage - Update route matching patterns
-
Navigation Components (
src/app/nav.rs)- Update link generation
- Fix navigation state management
-
Network Layer (
gloo-net0.2 → 0.6)- Update HTTP client usage
- Check for API changes in request/response handling
- Update error handling patterns
-
Storage & Console
- Update
gloo-storageusage patterns - Verify
gloo-consolecompatibility
- Update
- Heavy use of conditional hooks
- Complex state management with router integration
- JWT token handling with navigation
- Complex event handling
- Multiple hook interactions
- State synchronization issues
- Non-standard hook implementations
- State management patterns
- API client integration
- Document current functionality
- Create comprehensive test cases
- Screenshot all UI states
- Verify all routes work
- Test authentication flow end-to-end
- Validate form submissions
- Check frontend/backend management
- Verify dark theme styling
- Branch Strategy: Create
yew-0.21-upgradebranch - Incremental Updates: Fix one component at a time
- Compilation Driven: Let compiler errors guide fixes
- Testing After Each Phase: Ensure no regressions
- Hook Positioning: May require significant refactoring
- Router Migration: Could need component restructuring
- Custom Hooks: May need complete rewrite
- Event Handlers: Type system changes could be extensive
- Keep current 0.19 version as backup
- Document all breaking changes encountered
- Consider gradual migration over multiple PRs
- Performance: Latest Yew optimizations
- Security: Updated dependencies with patches
- Features: Access to newest Yew capabilities
- Ecosystem: Better compatibility with latest crates
- Future-Proofing: Easier future upgrades
Ready to vibe this upgrade to the next level! 🦀⚡✨