forked from reduxjs/redux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request reduxjs#3920 from andrewmcgivery/master
Former-commit-id: 756ba19
- Loading branch information
Showing
10 changed files
with
167 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"0": "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.", | ||
"1": "Expected the enhancer to be a function.", | ||
"2": "Expected the reducer to be a function.", | ||
"3": "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.", | ||
"4": "Expected the listener to be a function.", | ||
"5": "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.", | ||
"6": "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.", | ||
"7": "Actions must be plain objects. Use custom middleware for async actions.", | ||
"8": "Actions may not have an undefined \"type\" property. Have you misspelled a constant?", | ||
"9": "Reducers may not dispatch actions.", | ||
"10": "Expected the nextReducer to be a function.", | ||
"11": "Expected the observer to be an object.", | ||
"12": "bindActionCreators expected an object or a function, instead received . Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?", | ||
"13": "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.", | ||
"14": "Reducer \"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.", | ||
"15": "Reducer \"\" returned undefined when probed with a random type. Don't try to handle or other actions in \"redux/*\" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.", | ||
"16": "Super expression must either be null or a function" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
d8b8502a52b248ac7e5ebc22f33a4763e05af8b2 |
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,15 @@ | ||
/** | ||
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js | ||
* | ||
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes | ||
* during build. | ||
* @param {number} code | ||
*/ | ||
function formatProdErrorMessage(code: number) { | ||
return ( | ||
`Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or ` + | ||
'use the non-minified dev environment for full errors. ' | ||
) | ||
} | ||
|
||
export default formatProdErrorMessage |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,62 @@ | ||
import React from 'react' | ||
import Layout from '@theme/Layout' | ||
import { useLocation } from '@docusaurus/router' | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext' | ||
import styles from './styles.module.css' | ||
import errorCodes from '../../../errors.json' | ||
import 'url-search-params-polyfill' | ||
|
||
function Errors() { | ||
const location = useLocation() | ||
const context = useDocusaurusContext() | ||
const { siteConfig = {} } = context | ||
const errorCode = new URLSearchParams(location.search).get('code') | ||
const error = errorCodes[errorCode] | ||
|
||
return ( | ||
<Layout | ||
title={`${siteConfig.title} - A predictable state container for JavaScript apps.`} | ||
description="A predictable state container for JavaScript apps." | ||
> | ||
<main className={styles.mainFull}> | ||
<h1>Production Error Codes</h1> | ||
<p> | ||
When Redux is built and running in production, error text is replaced | ||
by indexed error codes to save on bundle size. These errors will | ||
provide a link to this page with more information about the error | ||
below. | ||
</p> | ||
{error && ( | ||
<React.Fragment> | ||
<p> | ||
<strong> | ||
The full text of the error you just encountered is: | ||
</strong> | ||
</p> | ||
<code className={styles.errorDetails}>{error}</code> | ||
</React.Fragment> | ||
)} | ||
|
||
<h2>All Error Codes</h2> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Code</th> | ||
<th>Message</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{Object.keys(errorCodes).map(code => ( | ||
<tr> | ||
<td>{code}</td> | ||
<td>{errorCodes[code]}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</main> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default Errors |
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