Title: run action while componentDidMount do not trigger props update · Issue #169 · developit/unistore · GitHub
Open Graph Title: run action while componentDidMount do not trigger props update · Issue #169 · developit/unistore
X Title: run action while componentDidMount do not trigger props update · Issue #169 · developit/unistore
Description: @connect({ a: 'a', }, { doSomething: () => { return {a: 'b'}; } }) export class Example extends Component
Open Graph Description: @connect({ a: 'a', }, { doSomething: () => { return {a: 'b'}; } }) export class Example extends Component
X Description: @connect({ a: 'a', }, { doSomething: () => { return {a: 'b'}; } }) export class Example extends Component<IProps, IState> { componentDidMount() { this.props.doSomething(); ...
Opengraph URL: https://github.com/developit/unistore/issues/169
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"run action while componentDidMount do not trigger props update","articleBody":"```\r\n@connect({\r\n a: 'a',\r\n}, {\r\n doSomething: () =\u003e {\r\n return {a: 'b'};\r\n }\r\n})\r\nexport class Example extends Component\u003cIProps, IState\u003e {\r\n componentDidMount() {\r\n this.props.doSomething();\r\n }\r\n\r\n componentWillReceiveProps(nextProps) {\r\n console.log(\"nextProps\", nextProps);\r\n }\r\n}\r\n```\r\n\r\nthis example shows what i had done.\r\n\r\n**i triggered an action in componentDidMount, but componentWillReceiveProps can not receive any update.**\r\n\r\ni look into the code and found out the problem is the wrapper outside my component register a listener while componentDidMount, but its child componet, **my component, mounted before the wrapper.**\r\n\r\n**so when my component run componentDidMount, the wrapper haven't run the subscription method yet. therefore it can't reveive any update.**\r\n\r\nso why not use the **componentWillMount** to replace the **componentDidMount**. **componentWillMount** will be triggered in a right order from parent to child. so subscription function can capture and update any changes from the child component.","author":{"url":"https://github.com/dev-johnny-gh","@type":"Person","name":"dev-johnny-gh"},"datePublished":"2019-08-09T13:53:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/169/unistore/issues/169"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6b8b7e3f-541b-65eb-068a-c6121cc11774 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCA6:E82BE:1335E00:18DBDF9:69908702 |
| html-safe-nonce | 299e2b54664217d5e49d29b103926a127628f17c8c0c20e6e02929e9c7c09d1f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0E2OkU4MkJFOjEzMzVFMDA6MThEQkRGOTo2OTkwODcwMiIsInZpc2l0b3JfaWQiOiI3ODEzNzQ5MDY0ODcwNDc5MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 283ccdbfabb8388a678e6002ac8985816089a3732bc3040fcec7c32e565b857c |
| hovercard-subject-tag | issue:478998963 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developit/unistore/169/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a42e1fcf5600252b86b5933d0f7a19fa937727dde60e7ccee7b592a38cdd15af/developit/unistore/issues/169 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a42e1fcf5600252b86b5933d0f7a19fa937727dde60e7ccee7b592a38cdd15af/developit/unistore/issues/169 |
| og:image:alt | @connect({ a: 'a', }, { doSomething: () => { return {a: 'b'}; } }) export class Example extends Component |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dev-johnny-gh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/developit/unistore git https://github.com/developit/unistore.git |
| octolytics-dimension-user_id | 105127 |
| octolytics-dimension-user_login | developit |
| octolytics-dimension-repository_id | 113351554 |
| octolytics-dimension-repository_nwo | developit/unistore |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113351554 |
| octolytics-dimension-repository_network_root_nwo | developit/unistore |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width