npm @elastic/react-search-ui 0.9.1
v0.9.1

latest releases: 1.22.0, 1.21.5, 1.21.4...
5 years ago

0.9.1 (June 5, 2019)

Breaking Changes

The performance fixes PR introduced significant changes to the Search UI API.

  • Search UI now has a peer dependency on react 16.8, bumped from 16.6.

  • SearchProvider no longer accepts a function as a child. This will affect
    EVERY Search UI implementation. If you were previously accessing State or Actions
    in that render prop, you will now need to instead use the WithSearch component.

    ex.

    Before:

    <SearchProvider config={config}>
      {({ searchTerm, setSearchTerm, results }) => {
        ...
      }}
    </SearchProvider>
    

    After:

    <SearchProvider config={config}>
      <WithSearch
          mapContextToProps={({ searchTerm, setSearchTerm, results }) => ({
            searchTerm,
            setSearchTerm,
            results
          })}
        >
        {({ searchTerm, setSearchTerm, results }) => {
          ...
        }}
      </WithSearch>
    </SearchProvider>
    
  • The API for withSearch has changed. You now must specify which actions and state you need in a
    mapContextToProps function.

Before:

export default withSearch(ResultsContainer);

After:

export default withSearch(({ results }) => ({ results }))(ResultsContainer);
  • All components in this library, and components created with withSearch are now
    "Pure Components". It is possible that if you were mutating state incorrectly with setState, that the components
    no longer update. See this guide for more information: https://reactjs.org/docs/optimizing-performance.html#examples.
  • SearchConsumer was renamed to WithSearch and now requires a mapContextToProps parameter.

Before:

<SearchConsumer>
  {({ searchTerm, setSearchTerm, results }) => {
    ...
  }}
</SearchConsumer>

After:

<WithSearch
    mapContextToProps={({ searchTerm, setSearchTerm, results }) => ({
      searchTerm,
      setSearchTerm,
      results
    })}
  >
  {({ searchTerm, setSearchTerm, results }) => {
    ...
  }}
</WithSearch>

Don't miss a new react-search-ui release

NewReleases is sending notifications on new releases.