-
Notifications
You must be signed in to change notification settings - Fork 461
refactor: modernize OrganisationSettingsPage #6312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
talissoncosta
wants to merge
16
commits into
refactor/migrate-critical-components-organisationsettingspage
Choose a base branch
from
refactor/migrate-organisationsettingspage
base: refactor/migrate-critical-components-organisationsettingspage
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
refactor: modernize OrganisationSettingsPage #6312
talissoncosta
wants to merge
16
commits into
refactor/migrate-critical-components-organisationsettingspage
from
refactor/migrate-organisationsettingspage
+666
−467
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f6a71c3 to
397b391
Compare
397b391 to
05441c7
Compare
Contributor
Docker builds report
|
- Add UpdateOrganisationBody type with optional fields - Add getOrganisation, updateOrganisation, deleteOrganisation request types - Support for organisation name, force_2fa, and project creation restrictions Part of OrganisationSettingsPage TypeScript migration
- Add getOrganisation query with cache tags - Add updateOrganisation mutation with optimistic updates - Add deleteOrganisation mutation with cache invalidation - Implement automatic rollback on error for optimistic updates Part of OrganisationSettingsPage TypeScript migration
- Add useUpdateOrganisationWithToast hook for consistent update handling - Add useDeleteOrganisationWithToast hook with success callbacks - Include toast notifications and error handling - Support legacy store sync via AppActions.refreshOrganisation() Part of OrganisationSettingsPage TypeScript migration
- Add OrganisationInformation component for name updates - Add Force2FASetting toggle component - Add RestrictProjectCreationSetting toggle component - Add DeleteOrganisation danger zone component with useHistory hook - All components use RTK Query mutations via custom hooks Part of OrganisationSettingsPage TypeScript migration
- Compose all General tab sections - Include JSONReference for debugging - Organize with SettingTitle sections - Clean component structure with proper TypeScript types Part of OrganisationSettingsPage TypeScript migration
- Add BillingTab with RTK Query useGetSubscriptionMetadataQuery - Add LicensingTab, CustomFieldsTab, APIKeysTab wrappers - Add WebhooksTab and SAMLTab wrappers - All tabs accept organisationId and use existing components Part of OrganisationSettingsPage TypeScript migration
- Use useRouteContext for organisationId (no URL param parsing) - Use useGetOrganisationQuery for all organisation data - Check permissions from organisation.role (no AccountStore) - Implement tabs array pattern matching ProjectSettingsPage - Add proper loading and error states - No legacy HOCs (withRouter, ConfigProvider) - Export directly without wrappers BREAKING CHANGE: Completely removes OrganisationProvider and AccountStore dependencies
- Remove old 466-line JavaScript class component - Update routes to import from organisation-settings folder - Complete migration to modern React with hooks and RTK Query Closes #5779
Replace legacy AccountStore usage with RTK Query for determining next
organisation after deletion. The hook now fetches the organisations
list and calculates the next available organisation ID, passing it to
the onSuccess callback for explicit navigation handling.
Changes:
- useDeleteOrganisationWithToast: Add useGetOrganisationsQuery hook
- Calculate next organisation ID before passing to callback
- DeleteOrganisation: Remove AccountStore and Utils imports
- Use direct URL construction for navigation
- Navigate to /organisation/{id}/projects or /organisations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add AppActions.refreshOrganisation() call after successful organisation deletion to ensure legacy components (navbar, permissions UI) that still use OrganisationStore stay in sync. This follows the same pattern as useUpdateOrganisationWithToast and useUpdateProjectWithToast hooks. Without this, legacy store-based components would show stale data after an organisation is deleted, while RTK Query components would update correctly via cache invalidation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add isLoading state to Delete Organisation button to prevent double-clicks and provide visual feedback during deletion. Button is disabled and shows "Deleting..." text while the deletion is in progress. This matches the pattern already implemented in OrganisationInformation for the Update button. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove self-explanatory comments that don't add value: - useUpdateOrganisationWithToast: Remove "Don't re-throw" comment - OrganisationSettingsPage: Remove "Check permission" comment - DeleteOrganisation: Remove navigation redirect comment Keep important comments that explain backward compatibility decisions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
During the migration, the data-test attribute was changed from 'organisation-name' to 'org-name', breaking E2E tests that rely on this selector. Restored the original 'organisation-name' selector to maintain compatibility with existing E2E tests in invite-test.ts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
705fffd to
4fd15de
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature!Changes
Overview
Migrated
OrganisationSettingsPagefrom a 466-line JavaScript class component to a modern TypeScript functional component architecture, replacing legacy Flux patterns with RTK Query and decomposing the monolithic component into well-structured, reusable modules.Key Improvements
1. Migration to TypeScript
UpdateOrganisationBodytype inrequests.tsOrganisationSettingsTabtype for tab configuration2. RTK Query Integration
AccountStoreandOrganisationProviderdependenciesuseOrganisation.ts:getOrganisation- Fetch single organisation with proper cache tagsupdateOrganisation- Update organisation with optimistic updatesdeleteOrganisation- Delete organisation with cache invalidation3. Custom Hooks for Reusable Logic
useUpdateOrganisationWithToast: Encapsulates update logic with toast notifications and error handlinguseDeleteOrganisationWithToast: Handles organisation deletion with:AppActions.refreshOrganisation()for backward compatibility4. Component Decomposition
Broke down the monolithic 466-line component into focused, maintainable modules:
5. Modern React Patterns
withRouterandConfigProviderHOCsmatch.paramswith context-based routing{ FC, ReactNode }instead ofReact.FC6. Navigation Improvements
/organisation/{nextOrgId}/projects/organisations(org list)7. Loading States & UX
8. Backward Compatibility
AppActions.refreshOrganisation(): Ensures legacy components (navbar, permissions UI) stay in sync9. Tab Array Pattern
Implemented clean, declarative tab configuration matching
ProjectSettingsPage:10. Permission Handling
organisation.roleinstead of AccountStoreUtils.getFlagsmithHasFeature()for conditional featuresorganisation.subscription.payment_methodHow did you test this code?
Manual Testing Performed
✅ Organisation Information Updates
✅ Admin Settings
✅ Organisation Deletion
/organisationspage✅ Tab Navigation
?tab=billing)✅ Permission Checks
✅ Loading States
✅ Backward Compatibility
✅ Error Handling
✅ Edge Cases
Closes #5779