Skip to content

Commit

Permalink
Merge rule details page lazy loading in same Suspense
Browse files Browse the repository at this point in the history
  • Loading branch information
umbopepato committed May 22, 2024
1 parent e6614fa commit 135f62b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,22 @@ export const RuleDetailsRoute: React.FunctionComponent<RuleDetailsRouteProps> =
return null;
};

return rule && ruleType && actionTypes ? (
<>
{getLegacyUrlConflictCallout()}
<RuleDetails
rule={rule}
ruleType={ruleType}
actionTypes={actionTypes}
requestRefresh={requestRefresh}
refreshToken={refreshToken}
/>
</>
) : (
<CenterJustifiedSpinner />
);
if (rule && ruleType && actionTypes) {
return (
<>
{getLegacyUrlConflictCallout()}
<RuleDetails
rule={rule}
ruleType={ruleType}
actionTypes={actionTypes}
requestRefresh={requestRefresh}
refreshToken={refreshToken}
/>
</>
);
}

return <CenterJustifiedSpinner />;
};

export async function getRuleData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';
import { ToastsApi } from '@kbn/core/public';
import React, { useState, useEffect, useRef, useCallback } from 'react';
import React, { useState, useEffect, useRef, useCallback, Suspense } from 'react';
import { Rule, RuleSummary, RuleType } from '../../../../types';
import {
ComponentOpts as RuleApis,
Expand Down Expand Up @@ -76,17 +76,19 @@ export const RuleRoute: React.FunctionComponent<WithRuleSummaryProps> = ({
);

return ruleSummary ? (
<Rules
requestRefresh={requestRefresh}
refreshToken={refreshToken}
rule={rule}
ruleType={ruleType}
readOnly={readOnly}
ruleSummary={ruleSummary}
numberOfExecutions={numberOfExecutions}
isLoadingChart={isLoadingChart}
onChangeDuration={onChangeDuration}
/>
<Suspense fallback={<CenterJustifiedSpinner />}>
<Rules
requestRefresh={requestRefresh}
refreshToken={refreshToken}
rule={rule}
ruleType={ruleType}
readOnly={readOnly}
ruleSummary={ruleSummary}
numberOfExecutions={numberOfExecutions}
isLoadingChart={isLoadingChart}
onChangeDuration={onChangeDuration}
/>
</Suspense>
) : (
<CenterJustifiedSpinner />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/172941
// FLAKY: https://github.com/elastic/kibana/issues/173008
describe.skip('Edit rule button', function () {
describe('Edit rule button', function () {
const ruleName = uuidv4();
const updatedRuleName = `Changed Rule Name ${ruleName}`;

Expand Down

0 comments on commit 135f62b

Please sign in to comment.