mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 15:29:19 +03:00
Turn your audience into a business. Publishing, memberships, subscriptions and newsletters.
bloggingcmsemberghosthacktoberfestheadless-cmsjamstackjavascriptjournalismnodejspublishingweb-application
b701ba9c0d
refs https://github.com/TryGhost/Team/issues/1858 fixes https://github.com/TryGhost/Team/issues/1789 - Split up the Comment component in many small Components to make it easier to read and maintain - Added support for synchronous actions, which are required for actions that affect the context state based on the current value (e.g., increasing a value by one) because of the asynchronous nature of setState: Before this change ``` // Context state: {hello: 0}; dispatchAction('increaseHelloByOne') dispatchAction('increaseHelloByOne') ``` Could end up having a state `{hello: 1}` instead of the expected `{hello: 2}`, because underlying this would resolve into: ``` // Context state: {hello: 0}; const hello = {hello: 0}; setState({hello: hello + 1}); setState({hello: hello + 1}); ``` Instead of ``` // Context state: {hello: 0}; setState(({hello}) => {hello: hello + 1}); setState(({hello}) => {hello: hello + 1}); ``` Synchronous actions now support this. - Removed deprecated `onAction` context state function - Replaced the boolean based form checking by the more reliable counter based checking that uses synchronous actions (reason we needed synchronous actions) (fixes https://github.com/TryGhost/Team/issues/1789) - Prevent creating a new `dispatchAction` function every time the context state changes, by using bind. This prevents infinte updates in `useEffect` hooks that depend on `dispatchAction` and also update the context via actions. |
||
---|---|---|
apps/comments-ui |