Skip to content

Commit

Permalink
Fix an issue preventing the directory middleware from working
Browse files Browse the repository at this point in the history
  • Loading branch information
ffraenz committed Jan 2, 2025
1 parent e909ba8 commit 42db2f1
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions packages/app-web/src/middlewares/directory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,20 @@ export const directoryMiddleware: Middleware<{}, RootState> = store => {
typeof action === 'object' &&
action !== null &&
'type' in action &&
typeof action.type === 'string' &&
'payload' in action &&
(
action.payload === undefined ||
(
typeof action.payload === 'object' &&
action.payload !== null &&
'directory' in action.payload
)
)
typeof action.type === 'string'
) {
// Inject the directory state into actions that depend on it
if ((directoryDependentActionTypes as string[]).includes(action.type)) {
if (action.payload === undefined) {
action.payload = {
action = {
...action,
payload: {
...(
'payload' in action && typeof action.payload === 'object'
? action.payload
: {}
),
directory: store.getState().directory
}
} else if (action.payload.directory === undefined) {
action.payload.directory = store.getState().directory
}
}
}
Expand Down

0 comments on commit 42db2f1

Please sign in to comment.