From 2c42bcd7e4a998c9ee8c795b9945cc02da58b21c Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Fri, 21 Jun 2019 15:11:42 +0200 Subject: [PATCH] SONAR-12072 Fix full re-rendering of the Projects list when paginating --- .../apps/projects/components/AllProjects.tsx | 73 ++--- .../__snapshots__/AllProjects-test.tsx.snap | 263 +++++++++--------- 2 files changed, 162 insertions(+), 174 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx index 70b8d4657a1..19b0afa67d3 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx @@ -309,43 +309,44 @@ export class AllProjects extends React.PureComponent { ); renderMain = () => { - return ( - - {this.getView() === 'visualizations' ? ( -
- {this.state.projects && ( - - )} -
- ) : ( -
- {this.state.projects && ( - - )} - -
+ if (this.state.loading && this.state.projects === undefined) { + return ; + } + + return this.getView() === 'visualizations' ? ( +
+ {this.state.projects && ( + + )} +
+ ) : ( +
+ {this.state.projects && ( + )} - + +
); }; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap index 28726c14b96..d902f9e0b70 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap @@ -111,66 +111,62 @@ exports[`renders 1`] = ` - -
- - -
-
+ } + /> + + `; @@ -243,31 +239,26 @@ exports[`renders 2`] = ` - -
- -
-
+ + `; @@ -411,70 +402,66 @@ exports[`renders correctly empty organization 3`] = ` - -
- - -
-
+ } + /> + + `; -- 2.39.5