Skip to content

Conversation

jmichalec-vl
Copy link

🚀 Upgrade strapi-plugin-soft-delete to Strapi v5

Overview

This PR upgrades the strapi-plugin-soft-delete from Strapi v4 to Strapi v5, ensuring full compatibility with the latest version while maintaining all original functionality. The upgrade addresses breaking changes in APIs, UI components, permission systems, and introduces support for Strapi v5's new Document Service API.

🎯 Key Changes

📊 Core API Migration

  • Document Service Integration: Added strapi.documents.use() middleware to intercept Content Manager delete operations
  • Database API Update: Migrated from strapi.query() to strapi.db.query() throughout
  • DocumentId Support: Full implementation of Strapi v5's UUID-based document system
  • Draft & Publish Enhancement: Proper handling of multiple document versions with same documentId

🎨 Admin Panel Modernization

  • Design System v2: Complete migration to Strapi's latest design system components
  • React Router v6: Updated navigation and routing for v5 compatibility
  • Professional UI: Full-width layout matching native Strapi v5 admin pages
  • Enhanced UX: Added Document ID column, improved table layout, better responsive design

🔒 Permission System Overhaul

  • RBAC Integration: Proper implementation of Strapi v5's useRBAC hook
  • Plugin Permissions: Registered custom permissions (explorer.restore, explorer.delete-permanently)
  • Policy Enforcement: Server-side policies correctly validate user permissions
  • Role-Based Access: Granular control over restore and delete permanently actions

Performance & Reliability

  • TypeScript Compliance: Zero compilation errors, full type safety
  • Error Handling: Robust error handling and user feedback
  • Event System: Proper EventHub integration with entity sanitization

🔧 Technical Details

Breaking Changes Addressed

  • strapi.query()strapi.db.query()
  • select: '*'select: ['*']
  • ✅ Design System v1 → v2 components
  • ✅ React Router v5 → v6 navigation
  • ✅ Permission system restructure
  • ✅ Entity Service API updates

New Features

  • Document ID Display: Shows Strapi v5 UUIDs in admin interface
  • Enhanced Filtering: Automatic soft-delete filtering in Content Manager
  • Bulk Operations: Improved restore/delete many operations
  • Permission Granularity: Separate permissions for restore vs delete permanently
  • Loading States: Better UX with proper loading indicators

🧪 Testing

Verified Functionality

  • Soft delete operations (individual & bulk)
  • Restore operations (individual & bulk)
  • Delete permanently operations (individual & bulk)
  • Permission-based UI visibility
  • Server-side policy enforcement
  • Draft & Publish compatibility
  • Multi-user scenarios with different roles
  • Schema field injection
  • Content Manager integration

Browser Compatibility

  • Chrome/Chromium
  • Firefox
  • Safari
  • Edge

📋 Migration Guide

For Plugin Users

  1. Update Strapi: Ensure you're running Strapi v5.x
  2. Install Plugin: npm install strapi-plugin-soft-delete@latest
  3. Update Config: No configuration changes required
  4. Permissions: Review role permissions in Settings → Roles → Plugins → Soft Delete

For Developers

  • All existing APIs remain compatible
  • Permission strings updated to use plugin-specific permissions
  • UI components now use Design System v2
  • TypeScript definitions updated for v5 compatibility

🚨 Breaking Changes

  • Minimum Strapi Version: Now requires Strapi v5.0.0+
  • Node.js: Minimum Node.js 18.0.0 (Strapi v5 requirement)
  • Permission Keys: Updated to use plugin-specific permission strings

📈 Performance Improvements

  • Reduced Bundle Size: Optimized imports and removed unused dependencies
  • Faster Queries: Improved database query efficiency with proper indexing
  • Better Caching: Enhanced caching strategy for permission checks
  • Responsive UI: Improved rendering performance with optimized components

🎉 Result

The plugin now provides:

  • Full Strapi v5 compatibility with modern APIs and UI
  • Enhanced user experience with professional admin interface
  • Robust permission system with granular access control
  • Production-ready code with comprehensive error handling
  • Future-proof architecture following Strapi v5 best practices

#15

@jmichalec-vl jmichalec-vl mentioned this pull request Sep 16, 2025
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