Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docs for v5 changes. #636

Merged
merged 52 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ea1894e
Update JSDocs for `createStructuredSelector`
aryaemami59 Nov 1, 2023
15feb03
Add units tests to showcase `createStructuredSelector`s second functi…
aryaemami59 Nov 1, 2023
e4fe262
Add more type tests
aryaemami59 Nov 1, 2023
f8cdab2
Fix `README` for v5.
aryaemami59 Nov 11, 2023
acb1c9d
Add `testUtils` file
aryaemami59 Nov 11, 2023
94fef76
Add `createCurriedSelector`
aryaemami59 Nov 11, 2023
93820c6
Fix issues with topic expansion in docs.
aryaemami59 Nov 11, 2023
8db66aa
Merge https://github.com/reduxjs/reselect into v5-docs
aryaemami59 Nov 11, 2023
212e889
Resolve merge conflicts
aryaemami59 Nov 11, 2023
c6dab42
Fix docs for selectors that take arguments
aryaemami59 Nov 11, 2023
5b30a5a
Add `@typescript/analyze-trace` to `devDependencies`
aryaemami59 Nov 13, 2023
d2987bd
Create separate `NPM` command for `@typescript/analyze-trace`
aryaemami59 Nov 13, 2023
1e091af
Add JSDocs for `MergeParameters`.
aryaemami59 Nov 13, 2023
5ff1968
Fix TS bug related to `OutputSelector`.
aryaemami59 Nov 13, 2023
7201083
Add JSDocs for `createCurriedSelector`
aryaemami59 Nov 13, 2023
12e2411
Fix toggle sections in `README`
aryaemami59 Nov 13, 2023
7e22290
Fix `TypedCreateSelector` in `README`
aryaemami59 Nov 13, 2023
bb82bf3
Add `createCurriedSelectorCreator` to docs.
aryaemami59 Nov 13, 2023
3b793a3
Fix library names formatting in docs
aryaemami59 Nov 15, 2023
bdf43e5
Fix API collapsed sections
aryaemami59 Nov 15, 2023
0112f1a
Remove `ParametricSelector` and `OutputParametricSelector`
aryaemami59 Nov 15, 2023
9f7c288
Remove `ParametricSelector` and `OutputParametricSelector` from type …
aryaemami59 Nov 15, 2023
76ad4fa
Remove `connect` reference from `createStructuredSelector` descriptio…
aryaemami59 Nov 15, 2023
dfe31f4
Move `createSelectorCreator` to be directly after `createSelector` in…
aryaemami59 Nov 15, 2023
55361f3
Remove duplicate explanation in the `autotrackMemoize` section in docs.
aryaemami59 Nov 15, 2023
b0fae92
Rename `autotrackMemoize` to `unstable_autotrackMemoize` in examples …
aryaemami59 Nov 15, 2023
af90f43
Add experimental warning label to `unstable_autotrackMemoize` in docs.
aryaemami59 Nov 15, 2023
1a5c72b
Fix `weakMapMemoize` examples.
aryaemami59 Nov 15, 2023
1768c20
Fix JSDocs for `weakMapMemoize`.
aryaemami59 Nov 15, 2023
191614c
Tweak example titles for memoize functions in docs.
aryaemami59 Nov 15, 2023
917afa2
Replace `createCurriedSelector` API with copy paste pattern in docs.
aryaemami59 Nov 15, 2023
de37737
Slightly Modify `createParametricSelectorHook` in docs
aryaemami59 Nov 18, 2023
38e7a40
Fix installation guide in docs
aryaemami59 Nov 18, 2023
3845404
Modify example for `createStructuredSelector` in docs.
aryaemami59 Nov 18, 2023
4458991
Add explanation underneath "How Does Reselect Work" in docs.
aryaemami59 Nov 18, 2023
4bb0655
Modify JSDocs for `createStructuredSelector` to match the docs.
aryaemami59 Nov 18, 2023
3871ae4
Update `createStructuredSelector` link in docs
aryaemami59 Nov 19, 2023
04d8241
Update `examples.test.ts` to match the docs.
aryaemami59 Nov 19, 2023
55ca12e
Add `dependencyRecomputations` and `resetDependencyRecomputations` to…
aryaemami59 Nov 19, 2023
3912374
Fix title of tests in `weakmapMemoize.spec.ts`.
aryaemami59 Nov 19, 2023
6f94ea7
Add "esModuleInterop" to tsconfig for vitest type tests.
aryaemami59 Nov 19, 2023
a031621
Add initial vitest type tests for `createSelectorCreator` and `create…
aryaemami59 Nov 19, 2023
7215304
Fix benchmarks for `orderOfExecution.bench.ts` and `weakMapMemoize.be…
aryaemami59 Nov 19, 2023
4595ef6
Update `yarn.lock`.
aryaemami59 Nov 19, 2023
3de5110
Remove changes unrelated to docs.
aryaemami59 Nov 19, 2023
97b73eb
Update lockfile
aryaemami59 Nov 19, 2023
ecd40bc
Remove other changes not related to docs
aryaemami59 Nov 19, 2023
2d6a4dd
Merge branch 'reduxjs:master' into v5-docs
aryaemami59 Nov 19, 2023
42dad9a
Fix links in JSDocs to match links in`README`
aryaemami59 Nov 20, 2023
999ca66
Remove some details wrappers and add additional descriptions
markerikson Nov 21, 2023
47fd0b5
Tweak TOC
markerikson Nov 21, 2023
c536318
Remove "Top-Level Selectors" since createSlice handles this in RTK 2.0
markerikson Nov 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading