Skip to content
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

[frontend] Fix for user deletion on cache + prevent loop on error on Private Root (#9719) #9720

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

Kedae
Copy link
Member

@Kedae Kedae commented Jan 26, 2025

Closes #9719

1 - User deletion doesn't trigger cache reset, hence we are trying to get a user from the cache that is deleted
2 - The default error boundary component is not usable is RootPrivate fails because it requires Intl

@Kedae Kedae added the filigran team use to identify PR from the Filigran team label Jan 26, 2025
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.24%. Comparing base (0d2a3f8) to head (1bfeb48).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9720      +/-   ##
==========================================
+ Coverage   65.24%   66.24%   +1.00%     
==========================================
  Files         630      630              
  Lines       60273    60420     +147     
  Branches     6763     7340     +577     
==========================================
+ Hits        39325    40028     +703     
+ Misses      20948    20392     -556     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@delemaf delemaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I works for me apart from the translation question

@@ -78,7 +83,7 @@ class ErrorBoundaryComponent extends React.Component {
const types = map((e) => e.extensions.code, [...baseErrors, ...retroErrors]);
// Specific error catching
if (includes('COMPLEX_SEARCH_ERROR', types)) {
return <DedicatedWarning title={'Complex search'} description={'Your search have too much terms to be executed. Please limit the number of words or the complexity'}/>;
return <DedicatedWarning title={'Complex search'} description={'Your search have too much terms to be executed. Please limit the number of words or the complexity'} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also translate this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I can inject formatter in ErrorBoundary

@@ -141,7 +141,7 @@ const platformUsers = (context: AuthContext) => {
const reloadUsers = async () => {
const users = await listAllEntities(context, SYSTEM_USER, [ENTITY_TYPE_USER], { connectionFormat: false });
const allUserIds = users.map((user) => user.internal_id);
return Bluebird.map(allUserIds, (userId: string) => resolveUserById(context, userId), { concurrency: ES_MAX_CONCURRENCY });
return Bluebird.map(allUserIds, (userId: string) => resolveUserById(context, userId), { concurrency: ES_MAX_CONCURRENCY }).filter((u) => u != null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why adding this filter ? can it happen ? since we just loaded the users from the database.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there could be a weird race-case scenario where the cache is reset while a user is being deleted -> users contains an ID that exists no longer in elastic.

@Kedae Kedae merged commit e277e6c into master Jan 27, 2025
9 checks passed
@Kedae Kedae deleted the issue/9719 branch January 27, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Platform crashes after user deletion
3 participants