title: ReduxToolKit: correct way to use SelectFromResult options in a Query hook?
body: <p>I am trying to understand how to correctly use SelectFromResult from the official documentation:</p>
  <p><a href="https://redux-toolkit.js.org/rtk-query/usage/queries#selecting-data-from-a-query-result" rel="nofollow noreferrer">https://redux-toolkit.js.org/rtk-query/usage/queries#selecting-data-from-a-query-result</a></p>
  <p>I have extended the Pokemon example to retrieve a filtered list of Pokemons ending in &quot;saur&quot; using SelectFromResult but the output results in a loss of error and isLoading data</p>
  <p>live sandbox here:
  <a href="https://codesandbox.io/s/rtk-query-selectfromresult-vvb7l" rel="nofollow noreferrer">https://codesandbox.io/s/rtk-query-selectfromresult-vvb7l</a></p>
  <p>relevant code here:</p>
  <p>the endpoint extracts out the relevant data with a transformResponse:</p>
  <pre><code>    getAllPokemon: builder.query({
        query: () =&gt; `pokemon/`,
        transformResponse: (response: any) =&gt; {
          console.log(&quot;transformResponse&quot;, response);
          return response.results;
        }
      })
  
  </code></pre>
  <p>and the hook fails if i try to selectFromResult and I lose error and isLoading variables as they are no longer returned from the hook. If I comment out the SelectFromResult option they are then correctly returned.</p>
  <pre><code>export const PokemonList = () =&gt; {
    const { data, error, isLoading } = useGetAllPokemonQuery(undefined, {
      selectFromResult: ({ data }) =&gt; ({
        data: data?.filter((item: Pokemon) =&gt; item.name.endsWith(&quot;saur&quot;))
      })
    });
  
    useEffect(() =&gt; {
      if (data) console.log(&quot;filtered result&quot;, data);
    }, [data]);
  
    return (
      &lt;div&gt;
        {data?.map((item: Pokemon) =&gt; (
          &lt;p&gt;{item.name}&lt;/p&gt;
        ))}
      &lt;/div&gt;
    );
  };
  
  </code></pre>
  <p>My question: I dont want to lose fetch status when trying to filter results using the recommended method. How do I modify the above code to correctly SelectFromResult and maintain the correct error, isLoading, etc status values from the hook?</p>