Websites v4 docs v12.7.0
    Preparing search index...

    Variable selectSelectedSectionConst

    selectSelectedSection: (
        state: { config: ConfigState } & { config: ConfigState },
        ...params: [],
    ) => { address: NodeAddress; section: Section<MixedSection> } | null & {
        clearCache: () => void;
        resetResultsCount: () => void;
        resultsCount: () => number;
    } & {
        dependencies: [
            (state: { config: ConfigState }) => { address: NodeAddress } | null,
            (
                state: { config: ConfigState },
            ) => Section<MixedSection> | null | undefined,
        ];
        dependencyRecomputations: () => number;
        lastResult: () => | {
            address: NodeAddress;
            section: Section<MixedSection>;
        }
        | null;
        memoizedResultFunc: (
            ...resultFuncArgs: [
                { address: NodeAddress }
                | null,
                Section<MixedSection> | null | undefined,
            ],
        ) => { address: NodeAddress; section: Section<MixedSection> } | null & {
            clearCache: () => void;
            resetResultsCount: () => void;
            resultsCount: () => number;
        };
        recomputations: () => number;
        resetDependencyRecomputations: () => void;
        resetRecomputations: () => void;
        resultFunc: (
            ...resultFuncArgs: [
                { address: NodeAddress }
                | null,
                Section<MixedSection> | null | undefined,
            ],
        ) => { address: NodeAddress; section: Section<MixedSection> } | null;
    } & {
        argsMemoize: <Func extends AnyFunction>(
            func: Func,
            options?: WeakMapMemoizeOptions<ReturnType<Func>>,
        ) => Func & {
            clearCache: () => void;
            resetResultsCount: () => void;
            resultsCount: () => number;
        };
        memoize: <Func extends AnyFunction>(
            func: Func,
            options?: WeakMapMemoizeOptions<ReturnType<Func>>,
        ) => Func & {
            clearCache: () => void;
            resetResultsCount: () => void;
            resultsCount: () => number;
        };
    } = ...

    Type Declaration

      • (
            state: { config: ConfigState } & { config: ConfigState },
            ...params: [],
        ): { address: NodeAddress; section: Section<MixedSection> } | null
      • A function that takes a state and returns data that is based on that state.

        Parameters

        • state: { config: ConfigState } & { config: ConfigState }

          The first argument, often a Redux root state object.

        • ...params: []

          All additional arguments passed into the selector.

        Returns { address: NodeAddress; section: Section<MixedSection> } | null

        A derived value from the state.

    • clearCache: () => void

      Clears the memoization cache associated with a memoized function. This method is typically used to reset the state of the cache, allowing for the garbage collection of previously memoized results and ensuring that future calls to the function recompute the results.

      Note: An output selector keeps a separate cache for its arguments (argsMemoize) and for its result (memoize). Calling clearCache on the selector only clears the former; to fully reset it, also call selector.memoizedResultFunc.clearCache().

    • resetResultsCount: () => void
    • resultsCount: () => number
    • dependencies: [
          (state: { config: ConfigState }) => { address: NodeAddress } | null,
          (
              state: { config: ConfigState },
          ) => Section<MixedSection> | null | undefined,
      ]

      The array of the input selectors used by createSelector to compose the combiner (OutputSelectorFields.memoizedResultFunc memoizedResultFunc).

    • dependencyRecomputations: () => number

      Counts the number of times the input selectors (OutputSelectorFields.dependencies dependencies) have been recalculated. This is distinct from OutputSelectorFields.recomputations recomputations, which tracks the recalculations of the result function.

      5.0.0

    • lastResult: () => { address: NodeAddress; section: Section<MixedSection> } | null

      The last result calculated by OutputSelectorFields.memoizedResultFunc memoizedResultFunc.

    • memoizedResultFunc: (
          ...resultFuncArgs: [
              { address: NodeAddress }
              | null,
              Section<MixedSection> | null | undefined,
          ],
      ) => { address: NodeAddress; section: Section<MixedSection> } | null & {
          clearCache: () => void;
          resetResultsCount: () => void;
          resultsCount: () => number;
      }

      The memoized version of OutputSelectorFields.resultFunc resultFunc.

      This holds its own cache, separate from the one attached to the output selector itself. To fully reset a selector, call clearCache on both (e.g. selector.clearCache() and selector.memoizedResultFunc.clearCache()).

    • recomputations: () => number

      Counts the number of times OutputSelectorFields.memoizedResultFunc memoizedResultFunc has been recalculated.

    • resetDependencyRecomputations: () => void

      Resets the count OutputSelectorFields.dependencyRecomputations dependencyRecomputations for the input selectors (OutputSelectorFields.dependencies dependencies) of a memoized selector.

      5.0.0

    • resetRecomputations: () => void

      Resets the count of OutputSelectorFields.recomputations recomputations count to 0.

    • resultFunc: (
          ...resultFuncArgs: [
              { address: NodeAddress }
              | null,
              Section<MixedSection> | null | undefined,
          ],
      ) => { address: NodeAddress; section: Section<MixedSection> } | null

      The final function passed to createSelector. Otherwise known as the combiner.

    • argsMemoize: <Func extends AnyFunction>(
          func: Func,
          options?: WeakMapMemoizeOptions<ReturnType<Func>>,
      ) => Func & {
          clearCache: () => void;
          resetResultsCount: () => void;
          resultsCount: () => number;
      }

      The optional memoize function that is used to memoize the arguments passed into the output selector generated by createSelector (e.g., lruMemoize or weakMapMemoize).

      When passed directly into createSelector, it overrides the argsMemoize function initially passed into createSelectorCreator. If none was initially provided, weakMapMemoize will be used.

      import { createSelector, weakMapMemoize } from 'reselect'

      const selectItemsByCategory = createSelector(
      [
      (state: RootState) => state.items,
      (state: RootState, category: string) => category
      ],
      (items, category) => items.filter(item => item.category === category),
      { argsMemoize: weakMapMemoize }
      )
      weakMapMemoize
      

      5.0.0

    • memoize: <Func extends AnyFunction>(
          func: Func,
          options?: WeakMapMemoizeOptions<ReturnType<Func>>,
      ) => Func & {
          clearCache: () => void;
          resetResultsCount: () => void;
          resultsCount: () => number;
      }

      The memoize function that is used to memoize the OutputSelectorFields.resultFunc resultFunc inside createSelector (e.g., lruMemoize or weakMapMemoize).

      When passed directly into createSelector, it overrides the memoize function initially passed into createSelectorCreator.

      import { createSelector, weakMapMemoize } from 'reselect'

      const selectItemsByCategory = createSelector(
      [
      (state: RootState) => state.items,
      (state: RootState, category: string) => category
      ],
      (items, category) => items.filter(item => item.category === category),
      { memoize: weakMapMemoize }
      )

      5.0.0