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

Fix: Screen blanking on render #2403

Merged
merged 3 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
justify-content: center;
align-items: center;
flex-direction: column;
position: relative;
}

#spinner-text {
Expand Down Expand Up @@ -41,6 +42,10 @@
border-color: #258ede transparent transparent transparent;
}

#spinner p {
margin: 0;
}

#lds-ring div:nth-child(1) {
animation-delay: -0.45s;
}
Expand All @@ -53,6 +58,16 @@
animation-delay: -0.15s;
}

.hidden {
display: none;
}

body {
margin: 0;
padding: 0;
border: 0;
}

@keyframes lds-ring {
0% {
transform: rotate(0deg);
Expand All @@ -77,7 +92,7 @@
<p id="spinner-text">Loading Graph Explorer</p>
</div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="root" class="hidden"></div>
</body>

</html>
</html>
2 changes: 2 additions & 0 deletions src/app/views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { QueryRunner } from './query-runner';
import { parse } from './query-runner/util/iframe-message-parser';
import { Sidebar } from './sidebar/Sidebar';
import { MainHeader } from './main-header/MainHeader';
import { removeSpinners } from '../..';

export interface IAppProps {
theme?: ITheme;
Expand Down Expand Up @@ -85,6 +86,7 @@ class App extends Component<IAppProps, IAppState> {
}

public componentDidMount = async () => {
removeSpinners();
this.displayToggleButton(this.mediaQueryList);
this.mediaQueryList.addListener(this.displayToggleButton);

Expand Down
32 changes: 19 additions & 13 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,27 @@ import { IDevxAPI } from './types/devx-api';
import { Mode } from './types/enums';
import { fetchResources } from './app/services/actions/resource-explorer-action-creators';

// removes the loading spinner from GE html after the app is loaded
const spinner = document.getElementById('spinner');
if (spinner !== null) {
(spinner as any).parentElement.removeChild(spinner);
}

// removes the loading spinner from the portal team html after GE loads
const apiExplorer = document.getElementsByTagName('api-explorer')[0];
if (apiExplorer) {
(apiExplorer as any).parentElement.removeChild(apiExplorer);
}

const appRoot: HTMLElement = document.getElementById('root')!;
initializeIcons();

let currentTheme = readTheme() || 'light';
export function removeSpinners() {
// removes the loading spinner from GE html after the app is loaded
const spinner = document.getElementById('spinner');
if (spinner !== null) {
(spinner as any).parentElement.removeChild(spinner);
}

// removes the loading spinner from the portal team html after GE loads
const apiExplorer = document.getElementsByTagName('api-explorer')[0];
if (apiExplorer) {
(apiExplorer as any).parentElement.removeChild(apiExplorer);
}

// makes appRoot visible
appRoot.classList.remove('hidden');
}

function setCurrentSystemTheme(): void {
const themeFromLocalStorage = readTheme();

Expand Down Expand Up @@ -186,5 +192,5 @@ const Root = () => {
</Provider>
);
};
const root = ReactDOM.createRoot(document.getElementById('root')!);
const root = ReactDOM.createRoot(appRoot);
root.render(<Root />);