File tree Expand file tree Collapse file tree 3 files changed +92
-1
lines changed Expand file tree Collapse file tree 3 files changed +92
-1
lines changed Original file line number Diff line number Diff line change 75
75
" api/createSelector" ,
76
76
" api/matching-utilities" ,
77
77
" api/other-exports" ,
78
- " api/codemods"
78
+ " api/codemods" ,
79
+ { "type" : " link" , "label" : " Error Messages" , "href" : " /errors" }
79
80
]
80
81
}
81
82
]
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import Layout from '@theme/Layout'
3
+ import { useLocation } from '@docusaurus/router'
4
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
5
+ import styles from './styles.module.css'
6
+ import errorCodes from '../../../errors.json'
7
+
8
+ function Errors ( ) {
9
+ const location = useLocation ( )
10
+ const context = useDocusaurusContext ( )
11
+ const { siteConfig = { } } = context
12
+ const errorCode = new URLSearchParams ( location . search ) . get ( 'code' )
13
+ const error = errorCodes [ errorCode ]
14
+
15
+ return (
16
+ < Layout
17
+ title = { `${ siteConfig . title } - ${ siteConfig . tagline } ` }
18
+ description = { siteConfig . tagline }
19
+ >
20
+ < main className = { styles . mainFull } >
21
+ < h1 > Production Error Codes</ h1 >
22
+ < p >
23
+ When Redux Toolkit is built and running in production, error text is
24
+ replaced by indexed error codes to save on bundle size. These errors
25
+ will provide a link to this page with more information about the error
26
+ below.
27
+ </ p >
28
+ { error && (
29
+ < React . Fragment >
30
+ < p >
31
+ < strong >
32
+ The full text of the error you just encountered is:
33
+ </ strong >
34
+ </ p >
35
+ < code className = { styles . errorDetails } > { error } </ code >
36
+ </ React . Fragment >
37
+ ) }
38
+
39
+ < h2 > All Error Codes</ h2 >
40
+ < table >
41
+ < thead >
42
+ < tr >
43
+ < th > Code</ th >
44
+ < th > Message</ th >
45
+ </ tr >
46
+ </ thead >
47
+ < tbody >
48
+ { Object . keys ( errorCodes ) . map ( ( code ) => (
49
+ < tr >
50
+ < td > { code } </ td >
51
+ < td > { errorCodes [ code ] } </ td >
52
+ </ tr >
53
+ ) ) }
54
+ </ tbody >
55
+ </ table >
56
+ </ main >
57
+ </ Layout >
58
+ )
59
+ }
60
+
61
+ export default Errors
Original file line number Diff line number Diff line change 80
80
font-size : 30px ;
81
81
margin-bottom : 55px ;
82
82
}
83
+
84
+ .mainFull {
85
+ padding : 34px 16px ;
86
+ width : 100% ;
87
+ max-width : var (--ifm-container-width );
88
+ margin : 0px auto;
89
+ }
90
+ .mainFull h1 {
91
+ font-size : 3rem ;
92
+ color : var (--ifm-heading-color );
93
+ font-weight : var (--ifm-heading-font-weight );
94
+ line-height : var (--ifm-heading-line-height );
95
+ }
96
+
97
+ .mainFull p {
98
+ margin-bottom : var (--ifm-leading );
99
+ margin-top : 0 ;
100
+ }
101
+
102
+
103
+ .errorDetails {
104
+ color : # ff6464 ;
105
+ border-radius : 0.5rem ;
106
+ padding : 1rem ;
107
+ margin : 30px 0 ;
108
+ font-weight : bold;
109
+ background-color : rgba (255 , 100 , 100 , 0.1 );
110
+ display : block;
111
+ }
You can’t perform that action at this time.
0 commit comments