Skip to content

Commit

Permalink
Merge pull request #636 from aryaemami59/v5-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson authored Nov 21, 2023
2 parents dd46128 + c536318 commit 6315862
Show file tree
Hide file tree
Showing 15 changed files with 2,821 additions and 1,518 deletions.
2,145 changes: 1,631 additions & 514 deletions README.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions docs/assets/diagrams/normal-memoization-function.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<mxfile host="65bd71144e" scale="1" border="0">
<diagram id="s5zgOlhoY8HzJwKQ5w-s" name="Page-1">
<mxGraphModel dx="1244" dy="636" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="2000" pageHeight="2000" background="#C7FFFB" math="0" shadow="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="7" value="" style="group;aspect=fixed;shadow=1;" vertex="1" connectable="0" parent="1">
<mxGeometry x="60" y="460" width="681.5" height="290" as="geometry"/>
</mxCell>
<mxCell id="2" value="Are arguments same as last time?" style="whiteSpace=wrap;html=1;rounded=1;shadow=1;aspect=fixed;" parent="7" vertex="1">
<mxGeometry x="250" y="20" width="150" height="80" as="geometry"/>
</mxCell>
<mxCell id="3" value="Return result." style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="7" vertex="1">
<mxGeometry x="460" y="180" width="110" height="60" as="geometry"/>
</mxCell>
<object label="Yes" id="4">
<mxCell style="edgeStyle=none;html=1;entryX=0;entryY=0;entryDx=0;entryDy=0;shadow=1;" parent="7" source="2" target="3" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</object>
<mxCell id="5" value="Run function again." style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="7" vertex="1">
<mxGeometry x="30" y="180" width="150" height="60" as="geometry"/>
</mxCell>
<mxCell id="6" value="No" style="edgeStyle=none;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;shadow=1;" parent="7" source="2" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="8" value="Untitled Layer" parent="0"/>
</root>
</mxGraphModel>
</diagram>
</mxfile>
40 changes: 40 additions & 0 deletions docs/assets/diagrams/reselect-memoization.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<mxfile host="65bd71144e">
<diagram id="hFjyuBP9kS8yiWHOacYP" name="Page-1">
<mxGraphModel dx="792" dy="1668" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" background="#C7FFFB" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="15" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="70" y="-110" width="930" height="440" as="geometry"/>
</mxCell>
<mxCell id="2" value="Are arguments same as last time?" style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="15" vertex="1">
<mxGeometry x="470.735" y="35.2" width="139.57750000000001" height="58.036" as="geometry"/>
</mxCell>
<mxCell id="3" value="Return result." style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="15" vertex="1">
<mxGeometry x="680" y="159.2" width="132.19" height="80" as="geometry"/>
</mxCell>
<mxCell id="8" value="Yes" style="edgeStyle=none;html=1;entryX=0;entryY=0;entryDx=0;entryDy=0;shadow=1;" parent="15" source="2" target="3" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="4" value="Run input selectors.&lt;br&gt;Are the results of input selectors same as last time?" style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="15" vertex="1">
<mxGeometry x="251.88" y="158.4" width="168.12" height="81.6" as="geometry"/>
</mxCell>
<mxCell id="9" value="No" style="edgeStyle=none;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;shadow=1;" parent="15" source="2" target="4" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="Return result." style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="15" vertex="1">
<mxGeometry x="470.7375" y="310" width="135.625" height="44" as="geometry"/>
</mxCell>
<mxCell id="13" value="Yes" style="edgeStyle=none;html=1;entryX=0;entryY=0;entryDx=0;entryDy=0;shadow=1;" parent="15" source="4" target="6" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="7" value="Run result function." style="whiteSpace=wrap;html=1;rounded=1;shadow=1;" parent="15" vertex="1">
<mxGeometry x="59.9975" y="310" width="135.625" height="44" as="geometry"/>
</mxCell>
<mxCell id="14" value="No" style="edgeStyle=none;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;shadow=1;" parent="15" source="4" target="7" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added docs/assets/normal-memoization-function.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/reselect-memoization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/autotrackMemoize/autotrackMemoize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ import { createCache } from './autotracking'
*
* @template Func - The type of the function that is memoized.
*
* @see {@link https://github.com/reduxjs/reselect#unstable_autotrackmemoizefunc---since-500 autotrackMemoize}
*
* @since 5.0.0
* @public
* @experimental
Expand Down
18 changes: 9 additions & 9 deletions src/createSelectorCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface CreateSelectorFunction<
* @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.
* @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.
*
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-selectoroptions createSelector}
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-createselectoroptions createSelector}
*/
<InputSelectors extends SelectorArray, Result>(
...createSelectorArgs: [
Expand All @@ -71,7 +71,7 @@ export interface CreateSelectorFunction<
* @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.
* @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.
*
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-selectoroptions createSelector}
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-createselectoroptions createSelector}
*/
<
InputSelectors extends SelectorArray,
Expand Down Expand Up @@ -112,7 +112,7 @@ export interface CreateSelectorFunction<
* @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.
* @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.
*
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-selectoroptions createSelector}
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-createselectoroptions createSelector}
*/
<
InputSelectors extends SelectorArray,
Expand Down Expand Up @@ -149,7 +149,7 @@ let globalStabilityCheck: StabilityCheckFrequency = 'once'
* This function allows you to override this setting for all of your selectors.
*
* **Note**: This setting can still be overridden per selector inside `createSelector`'s `options` object.
* See {@link https://github.com/reduxjs/reselect#per-selector-configuration per-selector-configuration}
* See {@link https://github.com/reduxjs/reselect#2-per-selector-by-passing-an-inputstabilitycheck-option-directly-to-createselector per-selector-configuration}
* and {@linkcode CreateSelectorOptions.inputStabilityCheck inputStabilityCheck} for more details.
*
* _The input stability check does not run in production builds._
Expand All @@ -171,8 +171,8 @@ import { OutputSelectorFields, Mapped } from './types';
* // Never run the input stability check.
* setInputStabilityCheckEnabled('never')
* ```
* @see {@link https://github.com/reduxjs/reselect#development-only-checks development-only-checks}
* @see {@link https://github.com/reduxjs/reselect#global-configuration global-configuration}
* @see {@link https://github.com/reduxjs/reselect#debugging-tools debugging-tools}
* @see {@link https://github.com/reduxjs/reselect#1-globally-through-setinputstabilitycheckenabled global-configuration}
*
* @since 5.0.0
* @public
Expand Down Expand Up @@ -211,7 +211,7 @@ export function setInputStabilityCheckEnabled(
* @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `defaultMemoize` or `weakMapMemoize`).
* @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `defaultMemoize` or `weakMapMemoize`). If none is explicitly provided, `defaultMemoize` will be used.
*
* @see {@link https://github.com/reduxjs/reselect#createselectorcreatormemoize-memoizeoptions createSelectorCreator}
* @see {@link https://github.com/reduxjs/reselect#createselectorcreatormemoize--options-memoizeoptions createSelectorCreator}
*
* @since 5.0.0
* @public
Expand Down Expand Up @@ -251,7 +251,7 @@ export function createSelectorCreator<
*
* @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `defaultMemoize` or `weakMapMemoize`).
*
* @see {@link https://github.com/reduxjs/reselect#createselectorcreatormemoize-memoizeoptions createSelectorCreator}
* @see {@link https://github.com/reduxjs/reselect#createselectorcreatormemoize--options-memoizeoptions createSelectorCreator}
*
* @public
*/
Expand Down Expand Up @@ -459,7 +459,7 @@ export function createSelectorCreator<
* a single "result function" / "combiner", and an optional options object, and
* generates a memoized selector function.
*
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-selectoroptions createSelector}
* @see {@link https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc-createselectoroptions createSelector}
*
* @public
*/
Expand Down
6 changes: 3 additions & 3 deletions src/createStructuredSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface SelectorsObject {
* The structured selector can take multiple input selectors
* and map their output to an object with specific keys.
*
* @see {@link https://github.com/reduxjs/reselect#createstructuredselectorinputselectors-selectorcreator--createselector createStructuredSelector}
* @see {@link https://github.com/reduxjs/reselect#createstructuredselector-inputselectorsobject--selectorcreator--createselector createStructuredSelector}
*
* @public
*/
Expand Down Expand Up @@ -171,7 +171,7 @@ export interface StructuredSelectorCreator {
* @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `defaultMemoize`.
* @template ArgsMemoizeFunction - The type of the of the memoize function that is used to memoize the arguments passed into the generated structured selector. It defaults to `defaultMemoize`.
*
* @see {@link https://github.com/reduxjs/reselect#createstructuredselectorinputselectors-selectorcreator--createselector createStructuredSelector}
* @see {@link https://github.com/reduxjs/reselect#createstructuredselector-inputselectorsobject--selectorcreator--createselector createStructuredSelector}
*/
<
InputSelectorsObject extends SelectorsObject,
Expand Down Expand Up @@ -234,7 +234,7 @@ export interface StructuredSelectorCreator {
* }))
* ```
*
* @see {@link https://github.com/reduxjs/reselect#createstructuredselectorinputselectors-selectorcreator--createselector createStructuredSelector}
* @see {@link https://github.com/reduxjs/reselect#createstructuredselector-inputselectorsobject--selectorcreator--createselector createStructuredSelector}
*
* @public
*/
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export interface CreateSelectorOptions<
*
* @default 'once'
*
* @see {@link https://github.com/reduxjs/reselect#development-only-checks development-only-checks}
* @see {@link https://github.com/reduxjs/reselect#debugging-tools debugging-tools}
* @see {@link https://github.com/reduxjs/reselect#inputstabilitycheck inputStabilityCheck}
* @see {@link https://github.com/reduxjs/reselect#per-selector-configuration per-selector-configuration}
* @see {@link https://github.com/reduxjs/reselect#2-per-selector-by-passing-an-inputstabilitycheck-option-directly-to-createselector per-selector-configuration}
*
* @since 5.0.0
*/
Expand Down
2 changes: 2 additions & 0 deletions src/weakMapMemoize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ function createCacheNode<T>(): CacheNode<T> {
*
* @template Func - The type of the function that is memoized.
*
* @see {@link https://github.com/reduxjs/reselect#weakmapmemoizefunc---since-500 weakMapMemoize}
*
* @since 5.0.0
* @public
* @experimental
Expand Down
Loading

0 comments on commit 6315862

Please sign in to comment.