Skip to content

Commit dc64413

Browse files
gurinder39Gurinder Singh
authored andcommitted
Grafana firefox (#77)
* vscode fix * fixed firefox bugs --------- Co-authored-by: Gurinder Singh <[email protected]>
1 parent 0b92d08 commit dc64413

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

public/app/features/dashboard/dashgrid/LazyLoader.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { useId, useRef, useState } from 'react';
2-
import * as React from 'react';
1+
import React, { useId, useRef, useState } from 'react';
32
import { useEffectOnce } from 'react-use';
43

54
export interface Props {

public/app/fn-app/fn-app-provider.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ export const FnAppProvider: FC<FnAppProviderProps> = (props) => {
4949
<BrowserRouter>
5050
<ErrorBoundaryAlert style="page">
5151
<GrafanaContext.Provider value={app.context}>
52-
<ThemeProvider value={config.theme2} children={
52+
<ThemeProvider value={config.theme2}>
5353
<>
5454
<GlobalStyles />
55-
{children || null}
56-
</>}
57-
/>
55+
{children}
56+
</>
57+
</ThemeProvider>
5858
</GrafanaContext.Provider>
5959
</ErrorBoundaryAlert>
6060
</BrowserRouter>

public/app/fn-app/fn-dashboard-page/fn-dashboard.tsx

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { pick } from 'lodash';
2-
import React, { FC, Suspense, useMemo } from 'react';
3-
import { lazily } from 'react-lazily';
2+
import React, { FC, useMemo } from 'react';
43
import { connect, MapStateToProps } from 'react-redux';
54

65
import {
@@ -11,25 +10,23 @@ import {
1110
FnPropsMappedFromState,
1211
} from 'app/core/reducers/fn-slice';
1312

13+
import { AngularRoot } from '../../angular/AngularRoot';
14+
import { FnAppProvider } from '../fn-app-provider';
1415
import { FNDashboardProps } from '../types';
1516
import { RenderPortal } from '../utils';
1617

17-
const { RenderFNDashboard } = lazily(() => import('./render-fn-dashboard'));
18-
const { FnAppProvider } = lazily(() => import('../fn-app-provider'));
19-
const { AngularRoot } = lazily(() => import('../../angular/AngularRoot'));
18+
import { RenderFNDashboard } from './render-fn-dashboard';
2019

2120
type FNDashboardComponentProps = Omit<FNDashboardProps, FnPropMappedFromState>;
2221

2322
export const FNDashboard: FC<FNDashboardComponentProps> = (props) => {
2423
return (
25-
<Suspense fallback={<>{props.fnLoader}</>}>
26-
<FnAppProvider fnError={props.fnError}>
27-
<div className="page-dashboard">
28-
<AngularRoot />
29-
<DashboardPortal {...props} />
30-
</div>
31-
</FnAppProvider>
32-
</Suspense>
24+
<FnAppProvider fnError={props.fnError}>
25+
<div className="page-dashboard">
26+
<AngularRoot />
27+
<DashboardPortal {...props} />
28+
</div>
29+
</FnAppProvider>
3330
);
3431
};
3532

@@ -42,7 +39,6 @@ function mapStateToProps(): MapStateToProps<
4239
}
4340

4441
export const DashboardPortalComponent: FC<FNDashboardComponentProps & FnPropsMappedFromState> = (props) => {
45-
4642
const content = useMemo(() => {
4743
if (!props.FNDashboard) {
4844
// TODO Use no data

public/app/fn-app/utils.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC } from 'react';
1+
import { FC, PropsWithChildren } from 'react';
22
import ReactDOM from 'react-dom';
33

44
export interface RenderPortalProps {
@@ -7,14 +7,12 @@ export interface RenderPortalProps {
77

88
export const getPortalContainer = (ID: string): HTMLElement | null => document.getElementById(ID);
99

10-
export const RenderPortal: FC<RenderPortalProps> = ({ ID, children }) => {
11-
const portalDiv = getPortalContainer(ID)
12-
13-
if(!portalDiv){
10+
export const RenderPortal: FC<PropsWithChildren<RenderPortalProps>> = ({ ID, children }) => {
11+
const portalDiv = getPortalContainer(ID);
12+
13+
if (!portalDiv) {
1414
return null;
1515
}
1616

1717
return ReactDOM.createPortal(children, portalDiv);
1818
};
19-
20-

0 commit comments

Comments
 (0)