Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
4e6d61ec
Unverified
Commit
4e6d61ec
authored
1 year ago
by
Nicolò Pretto
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
type createThunkAction to avoid it leaking anys in all the codebase (#35784)
parent
ba7543a4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/lib/redux/typed-utils.ts
+13
-1
13 additions, 1 deletion
frontend/src/metabase/lib/redux/typed-utils.ts
frontend/src/metabase/lib/redux/utils.js
+0
-6
0 additions, 6 deletions
frontend/src/metabase/lib/redux/utils.js
with
13 additions
and
7 deletions
frontend/src/metabase/lib/redux/typed-utils.ts
+
13
−
1
View file @
4e6d61ec
import
{
createAsyncThunk
as
createAsyncThunkOriginal
}
from
"
@reduxjs/toolkit
"
;
import
type
{
State
}
from
"
metabase-types/store
"
;
import
type
{
State
,
Dispatch
,
GetState
}
from
"
metabase-types/store
"
;
import
{
withAction
}
from
"
./utils
"
;
interface
ThunkConfig
{
state
:
State
;
...
...
@@ -7,3 +8,14 @@ interface ThunkConfig {
export
const
createAsyncThunk
=
createAsyncThunkOriginal
.
withTypes
<
ThunkConfig
>
();
// similar to createAction but accepts a (redux-thunk style) thunk and dispatches based on whether
// the promise returned from the thunk resolves or rejects, similar to redux-promise
export
function
createThunkAction
<
TArgs
extends
any
[]
>
(
actionType
:
string
,
thunkCreator
:
(
...
args
:
TArgs
)
=>
(
dispatch
:
Dispatch
,
getState
:
GetState
)
=>
any
,
):
(...
args
:
TArgs
)
=>
any
{
return
withAction
(
actionType
)(
thunkCreator
);
}
This diff is collapsed.
Click to expand it.
frontend/src/metabase/lib/redux/utils.js
+
0
−
6
View file @
4e6d61ec
...
...
@@ -19,12 +19,6 @@ import { delay } from "metabase/lib/promise";
export
{
combineReducers
,
compose
}
from
"
@reduxjs/toolkit
"
;
export
{
handleActions
,
createAction
}
from
"
redux-actions
"
;
// similar to createAction but accepts a (redux-thunk style) thunk and dispatches based on whether
// the promise returned from the thunk resolves or rejects, similar to redux-promise
export
function
createThunkAction
(
actionType
,
thunkCreator
)
{
return
withAction
(
actionType
)(
thunkCreator
);
}
// turns string timestamps into moment objects
export
function
momentifyTimestamps
(
object
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment