Skip to content

Commit

Permalink
Rule and sensor screens loading fixes, when switching tabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrczarnas committed Jan 30, 2024
1 parent 00f3302 commit e686753
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions dqops/src/main/frontend/src/pages/RuleDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const RuleDetail = () => {
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);

useEffect(() => {
if (!ruleDetail && (type !== 'create' || copied === true)) {
if (full_rule_name !== undefined && !ruleDetail && (type !== 'create' || copied === true)) {
dispatch(getRule(urlencodeDecoder(String(full_rule_name))));
}
}, [full_rule_name, ruleDetail, type]);
Expand All @@ -62,11 +62,13 @@ export const RuleDetail = () => {
if (type === 'create' && copied !== true) {
setRuleName('');
} else {
setRuleName(
String(full_rule_name).split('/')[
String(full_rule_name).split('/').length - 1
] + '_copy'
);
if (full_rule_name !== undefined) {
setRuleName(
String(full_rule_name).split('/')[
String(full_rule_name).split('/').length - 1
] + '_copy'
);
}
}
}, [type, copied]);

Expand Down
14 changes: 8 additions & 6 deletions dqops/src/main/frontend/src/pages/SensorDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,21 @@ export const SensorDetail = () => {
);

useEffect(() => {
if (!sensorDetail && (type !== 'create' || copied === true)) {
if (full_sensor_name !== undefined && !sensorDetail && (type !== 'create' || copied === true)) {
dispatch(getSensor(full_sensor_name));
}
}, [full_sensor_name, sensorDetail, type]);
useEffect(() => {
if (type === 'create' && copied !== true) {
setSensorName('');
} else {
setSensorName(
String(full_sensor_name).split('/')[
String(full_sensor_name).split('/').length - 1
] + '_copy'
);
if (full_sensor_name !== undefined) {
setSensorName(
String(full_sensor_name).split('/')[
String(full_sensor_name).split('/').length - 1
] + '_copy'
);
}
}
}, [type, copied]);

Expand Down

0 comments on commit e686753

Please sign in to comment.