File tree 4 files changed +17
-29
lines changed
4 files changed +17
-29
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,6 @@ export const SET_BLOB_URL = 'SET_BLOB_URL';
52
52
export const EXPAND_SIDEBAR = 'EXPAND_SIDEBAR' ;
53
53
export const COLLAPSE_SIDEBAR = 'COLLAPSE_SIDEBAR' ;
54
54
55
- export const CONSOLE_EVENT = 'CONSOLE_EVENT' ;
56
- export const CLEAR_CONSOLE = 'CLEAR_CONSOLE' ;
57
55
export const EXPAND_CONSOLE = 'EXPAND_CONSOLE' ;
58
56
export const COLLAPSE_CONSOLE = 'COLLAPSE_CONSOLE' ;
59
57
@@ -140,3 +138,6 @@ export const START_SAVING_PROJECT = 'START_SAVING_PROJECT';
140
138
export const END_SAVING_PROJECT = 'END_SAVING_PROJECT' ;
141
139
142
140
export const SET_COOKIE_CONSENT = 'SET_COOKIE_CONSENT' ;
141
+
142
+ export const CONSOLE_EVENT = 'CONSOLE_EVENT' ;
143
+ export const CLEAR_CONSOLE = 'CLEAR_CONSOLE' ;
Original file line number Diff line number Diff line change 1
- import * as ActionTypes from '../../../constants' ;
2
-
3
- export function clearConsole ( ) {
4
- return {
5
- type : ActionTypes . CLEAR_CONSOLE
6
- } ;
7
- }
8
-
9
- export function dispatchConsoleEvent ( messages ) {
10
- return {
11
- type : ActionTypes . CONSOLE_EVENT ,
12
- event : messages
13
- } ;
14
- }
1
+ export { dispatchConsoleEvent , clearConsole } from '../reducers/console' ;
Original file line number Diff line number Diff line change 1
- import * as ActionTypes from '../../../constants ' ;
1
+ import { createSlice } from '@reduxjs/toolkit ' ;
2
2
3
3
const consoleMax = 5000 ;
4
4
const initialState = [ ] ;
5
5
6
- const console = ( state = initialState , action ) => {
7
- let messages ;
8
- switch ( action . type ) {
9
- case ActionTypes . CONSOLE_EVENT :
10
- messages = [ ...action . event ] ;
6
+ const consoleSlice = createSlice ( {
7
+ name : 'console' ,
8
+ initialState,
9
+ reducers : {
10
+ dispatchConsoleEvent : ( state , action ) => {
11
+ const messages = [ ...action . payload ] ;
11
12
return state . concat ( messages ) . slice ( - consoleMax ) ;
12
- case ActionTypes . CLEAR_CONSOLE :
13
- return [ ] ;
14
- default :
15
- return state ;
13
+ } ,
14
+ clearConsole : ( ) => [ ]
16
15
}
17
- } ;
16
+ } ) ;
18
17
19
- export default console ;
18
+ export const { dispatchConsoleEvent, clearConsole } = consoleSlice . actions ;
19
+ export default consoleSlice . reducer ;
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export default function setupStore(initialState) {
24
24
middleware : ( getDefaultMiddleware ) =>
25
25
getDefaultMiddleware ( {
26
26
thunk : true ,
27
- serializableCheck : true ,
27
+ serializableCheck : false ,
28
28
// TODO: enable immutableCheck once the mutations are fixed.
29
29
immutableCheck : false
30
30
} ) . concat ( listenerMiddleware . middleware ) ,
You can’t perform that action at this time.
0 commit comments