-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Designer): Dynamic data performance improvements (#4483)
* Combined dynamic data clear dispatches * Added .eslintcache to .gitignore * Reduced dispatches on load * Schema request is now cached so multiple operations can share data * Added performance debug component for testing * Don't run dev slice in prod * Removed .eslintcache from repo * Collapsed "updateExistingInputTokenTitles" action * Removed unneeded "updateNodeParameters" dispatch * Removed comments + log --------- Co-authored-by: Riley Evans <rileyevans@Rileys-MacBook-Pro.local>
- Loading branch information
Showing
25 changed files
with
498 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface DevState { | ||
reduxActionCounts?: Record<string, number>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { RootState } from '../../store'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
export const useReduxActionCounts = () => { | ||
return useSelector((state: RootState) => state.dev.reduxActionCounts ?? {}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { resetWorkflowState } from '../global'; | ||
import type { DevState } from './devInterfaces'; | ||
import { createSlice } from '@reduxjs/toolkit'; | ||
|
||
const initialState: DevState = { | ||
reduxActionCounts: {}, | ||
}; | ||
|
||
export const devSlice = createSlice({ | ||
name: 'dev', | ||
initialState, | ||
reducers: { | ||
// Nothing | ||
}, | ||
extraReducers: (builder) => { | ||
// Reset the state on workflow reset | ||
builder.addCase(resetWorkflowState, () => initialState); | ||
// Count the number of times each action is dispatched | ||
builder.addMatcher( | ||
() => true, | ||
(state, action) => { | ||
state.reduxActionCounts = { | ||
...state.reduxActionCounts, | ||
[action.type]: (state.reduxActionCounts?.[action.type] ?? 0) + 1, | ||
}; | ||
} | ||
); | ||
}, | ||
}); | ||
|
||
export default devSlice.reducer; |
Oops, something went wrong.