Skip to content

Commit e68ed5a

Browse files
committed
readability improvements
1 parent 8de59ec commit e68ed5a

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

dashi/src/demo/actions/hidePanel.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { updateContributionContainer } from "@/lib";
22
import type { PanelState } from "@/demo/types";
33

44
export function hidePanel(panelIndex: number) {
5-
updateContributionContainer<PanelState>("panels", panelIndex, {
6-
visible: false,
7-
});
5+
updateContributionContainer<PanelState>(
6+
"panels",
7+
panelIndex,
8+
{
9+
visible: false,
10+
},
11+
false,
12+
);
813
}

dashi/src/lib/actions/handleComponentChange.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function handleComponentChange(
1212
contribIndex: number,
1313
changeEvent: ComponentChangeEvent,
1414
) {
15+
// Apply actual component state change immediately
1516
applyStateChangeRequests([
1617
{
1718
contribPoint,

dashi/src/lib/actions/updateContributionContainer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export function updateContributionContainer<S extends object = object>(
1717
if (contributionState.container === container) {
1818
return; // nothing to do
1919
}
20-
const componentStatus = contributionState.componentResult.status;
21-
if (!requireComponent || componentStatus) {
20+
const isLayoutFetched = Boolean(contributionState.componentResult.status);
21+
if (!requireComponent || isLayoutFetched) {
2222
_updateContributionState(contribPoint, contribIndex, {
2323
container,
2424
});
25-
} else if (!componentStatus) {
25+
} else if (!isLayoutFetched) {
2626
// No status yet, so we must load the component
2727
_updateContributionState(contribPoint, contribIndex, {
2828
container,

dashi/src/lib/api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface ApiOptions {
44
}
55

66
export interface ApiResult<T> {
7-
status?: "pending" | "ok" | "failed";
7+
status?: "pending" | "ok" | "failed" | undefined;
88
data?: T;
99
error?: ApiError;
1010
}

0 commit comments

Comments
 (0)