kiwicom / margarita

[not actively maintained] Mobile and Web application implementing Kiwi.com Tequila API
https://margarita.kiwi.com/
MIT License
209 stars 42 forks source link

Refactor: remove default state settings from props #818

Closed FilipMessa closed 5 years ago

FilipMessa commented 5 years ago

I realized that we set the default state for the SearchContext from props, but I can't find any use case for that, and also props sending to SearchContext are different that flowTypes expected.

PLEASE double check if I didn't miss something.

netlify[bot] commented 5 years ago

Storybook from packages/universal-components

Built with commit 403128b832793f8c96d5524dd6774ed643635f5b

https://deploy-preview-818--kiwicom-universal-components.netlify.com

aalises commented 5 years ago

Yes, they were added here (https://github.com/kiwicom/margarita/pull/658) because before the persistence of the search parameters was done on reload by getting them from the router query params and passing them as props to the context to repopulate it.

However, here (https://github.com/kiwicom/margarita/pull/695) was changed to set it from an action in the context (setStateFromQueryParams) which is called on ComponentDidMount on the components that use it (Results and Search). So the props are indeed useless now :)