Skip to content

Commit

Permalink
Attempt to correct AAPM behavior without setTimeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
greinard committed Mar 6, 2024
1 parent ce9aa1c commit bca644b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@careevolution/mydatahelps-ui",
"version": "2.13.1-AsthmaUpdates.2",
"version": "2.13.1-AsthmaUpdatesAAP.0",
"description": "MyDataHelps UI Library",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import './AsthmaActionPlanManager.css';
import { Button, LoadingIndicator, Title, UnstyledButton } from '../../../presentational';
import MyDataHelps, { DeviceInfo } from '@careevolution/mydatahelps-js';
import { useInitializeView } from '../../../../helpers/Initialization';
import { asthmaDataService } from '../../helpers';
import { AsthmaActionPlan } from '../../model';
import language from '../../../../helpers/language';
Expand Down Expand Up @@ -37,7 +36,7 @@ export default function (props: AsthmaActionPlanManagerProps) {
});
};

const initialize = (): void => {
useEffect(() => {
setLoading(true);

if (props.previewState === 'loading') {
Expand All @@ -58,10 +57,13 @@ export default function (props: AsthmaActionPlanManagerProps) {
setDeviceInfo(deviceInfo);
});

setTimeout(loadActionPlan, 500);
};
loadActionPlan();

useInitializeView(initialize, [], [props.previewState]);
MyDataHelps.on('surveyDidFinish', loadActionPlan);
return () => {
MyDataHelps.off('surveyDidFinish', loadActionPlan);
}
}, [props.previewState]);

const onLearnMore = (): void => {
if (props.previewState) return;
Expand All @@ -83,11 +85,13 @@ export default function (props: AsthmaActionPlanManagerProps) {
const onEditActionPlan = (): void => {
if (props.previewState) return;
MyDataHelps.startSurvey(props.editActionPlanSurveyName);
setLoading(true);
};

const onUploadActionPlan = (): void => {
if (props.previewState) return;
MyDataHelps.startSurvey(props.editActionPlanSurveyName);
setLoading(true);
};

return <div className="mdhui-asthma-action-plan-manager">
Expand Down

0 comments on commit bca644b

Please sign in to comment.