Skip to content

Commit ba0a754

Browse files
feat(overmind-devtools): show action path in history
1 parent ef21a65 commit ba0a754

File tree

6 files changed

+27
-23
lines changed

6 files changed

+27
-23
lines changed

packages/node_modules/overmind-devtools/backend/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function createWindow() {
1212
icon: path.resolve('icons', 'icon.png'),
1313
height: 768,
1414
width: 768,
15-
minHeight: 768,
16-
minWidth: 768,
15+
minHeight: 500,
16+
minWidth: 500,
1717
})
1818
const connectionManager = new ConnectionManager(mainWindow)
1919

packages/node_modules/overmind-devtools/src/components/History/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212
FaCode,
1313
FaLink,
1414
FaSave,
15-
FaVolumeDown,
16-
FaVolumeUp,
1715
FaDatabase,
1816
FaClock,
1917
FaCheck,
@@ -34,6 +32,9 @@ const History: FunctionComponent = () => {
3432
<div className={styles.label}>
3533
<FaDatabase />
3634
</div>
35+
<div className={styles.actionName}>
36+
{mutationRecord.actionName}
37+
</div>
3738
<div className={styles.mutationType}>
3839
{mutationRecord.data.method}
3940
</div>
@@ -55,8 +56,8 @@ const History: FunctionComponent = () => {
5556
<div className={styles.label}>
5657
<FaSave />
5758
</div>
58-
<div className={styles.flushActionName}>
59-
{flushRecord.data.actionName}
59+
<div className={styles.actionName}>
60+
{flushRecord.actionName}
6061
</div>
6162
<div className={styles.flushDetail}>
6263
{flushRecord.data.components.length} <FaCode />
@@ -93,6 +94,9 @@ const History: FunctionComponent = () => {
9394
<div className={styles.label}>
9495
{effectRecord.data.isPending ? <FaClock /> : <FaCheck />}
9596
</div>
97+
<div className={styles.actionName}>
98+
{effectRecord.actionName}
99+
</div>
96100
<div className={styles.effectPath}>
97101
{effectRecord.data.name
98102
? effectRecord.data.name + '.' + effectRecord.data.method

packages/node_modules/overmind-devtools/src/components/History/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const flushDetail = css({
7272
display: 'block',
7373
},
7474
})
75-
export const flushActionName = css({
75+
export const actionName = css({
7676
padding: '0 0.5rem',
7777
})
7878

packages/node_modules/overmind-devtools/src/overmind/state.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type State = {
3737
flushesMutationsCount: Derive<State, number>
3838
flushesStatePathCount: Derive<State, number>
3939
groupedComponents: Derive<State, GroupedComponents>
40-
history: Derive<State, HistoryRecord[]>
40+
history: Derive<State, HistoryRecord<any, any>[]>
4141
currentOperatorsByPath: Derive<State, OperatorsByPath[]>
4242
}
4343

@@ -129,6 +129,7 @@ const state: State = {
129129
const mutationRecord: MutationHistoryRecord = {
130130
type: HistoryRecordType.Mutation,
131131
data: mutation,
132+
actionName: mutationsMessage.data.actionName,
132133
}
133134

134135
return mutationRecord
@@ -140,14 +141,14 @@ const state: State = {
140141
const flushRecord: FlushHistoryRecord = {
141142
type: HistoryRecordType.Flush,
142143
data: {
143-
...flush,
144144
components: flush.components.map(
145145
(componentId) => state.currentApp.components[componentId].name
146146
),
147147
derived: flush.derived.map(
148148
(derivedId) => state.currentApp.derived[derivedId]
149149
),
150150
},
151+
actionName: flushMessage.data.actionName,
151152
}
152153

153154
return aggr.concat(flushRecord)
@@ -156,6 +157,7 @@ const state: State = {
156157
const effectRecord: EffectHistoryRecord = {
157158
type: HistoryRecordType.Effect,
158159
data: effectMessage.data,
160+
actionName: effectMessage.data.actionName,
159161
}
160162

161163
return aggr.concat(effectRecord)

packages/node_modules/overmind-devtools/src/overmind/types.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,25 +143,23 @@ export enum HistoryRecordType {
143143
Flush = 'Flush',
144144
}
145145

146-
export type HistoryRecord = {
146+
export type HistoryRecord<Type extends HistoryRecordType, data> = {
147147
type: HistoryRecordType
148148
data: any
149+
actionName: string
149150
}
150151

151-
export type MutationHistoryRecord = {
152-
type: HistoryRecordType.Mutation
153-
data: Mutation
154-
}
152+
export type MutationHistoryRecord = HistoryRecord<
153+
HistoryRecordType.Mutation,
154+
Mutation
155+
>
155156

156-
export type FlushHistoryRecord = {
157-
type: HistoryRecordType.Flush
158-
data: Flush
159-
}
157+
export type FlushHistoryRecord = HistoryRecord<HistoryRecordType.Flush, Flush>
160158

161-
export type EffectHistoryRecord = {
162-
type: HistoryRecordType.Effect
163-
data: Effect
164-
}
159+
export type EffectHistoryRecord = HistoryRecord<
160+
HistoryRecordType.Effect,
161+
Effect
162+
>
165163

166164
export type App = {
167165
name: string

packages/overmind-website/src/overmind/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export const test: Operator<string> = pipe(
142142
false: mutate(function falsePath() {}),
143143
}
144144
),
145-
filter(() => true),
145+
filter(() => false),
146146
parallel(
147147
pipe(
148148
map(function pa1({ state }, val) {

0 commit comments

Comments
 (0)