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

Derived Stores #40

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
d3be221
feat!: initial work on adding derived signals
crutchcorn Feb 5, 2024
5830fca
chore: add tests to derived state
crutchcorn Feb 5, 2024
ae74fa5
fix: add cleanup edgecase
crutchcorn Feb 5, 2024
605b520
fix: edgecase where using derived and store for base
crutchcorn Feb 5, 2024
9d4deb7
docs: update docs link
crutchcorn Feb 6, 2024
12d40a6
chore: refactor derived class
crutchcorn Feb 6, 2024
368db9d
chore: further refactors
crutchcorn Feb 6, 2024
759040d
chore: refactor work to make things a bit cleaner
crutchcorn Feb 6, 2024
d79b473
chore: minor renaming and cleanup
crutchcorn Feb 7, 2024
5700cc3
chore: add initial benchmarks
crutchcorn Feb 7, 2024
0f7c648
chore: add Angular
crutchcorn Feb 7, 2024
f0ec935
chore: update benchmark package versions
crutchcorn Feb 7, 2024
790303c
chore: fix ci
crutchcorn Feb 7, 2024
5a069c7
chore: move to proper derived store
crutchcorn Feb 9, 2024
157413f
fix: avoid issues with what signal is being written
crutchcorn Feb 9, 2024
192829c
chore: ignore benchmark file in test coverage
crutchcorn Feb 9, 2024
f4dc9da
chore: rename TSX to TS
crutchcorn Feb 9, 2024
b7987e8
feat: add Effect
crutchcorn Feb 9, 2024
aa447aa
Merge branch 'main' into derived-diamond-problem
lachlancollins Feb 17, 2024
87dd588
Fix eslint, sherif, and knip
lachlancollins Feb 17, 2024
de55814
chore: migrate from forEach to for of loop
crutchcorn Feb 26, 2024
2bb46e3
Merge branch 'main' into derived-diamond-problem
crutchcorn Aug 12, 2024
fa65a7e
ci: apply automated fixes
autofix-ci[bot] Aug 12, 2024
357a301
improve Vue performance (#122)
ZainW Sep 29, 2024
228db0e
feat: add lazyness to derived (#109)
crutchcorn Nov 25, 2024
925ecae
Merge branch 'main' into derived-diamond-problem
crutchcorn Nov 25, 2024
81ef72c
chore: migrate to options object over positional arguments
crutchcorn Nov 25, 2024
eac78fa
ci: apply automated fixes
autofix-ci[bot] Nov 25, 2024
a7e9cbe
chore: fix sherif
crutchcorn Nov 25, 2024
62c3664
Merge branch 'main' into derived-diamond-problem
crutchcorn Nov 25, 2024
bd900f7
docs: add autogenerated docs for effect and derived
crutchcorn Nov 25, 2024
3db6e6f
Merge branch 'main' into derived-diamond-problem
crutchcorn Nov 25, 2024
49e47ea
Merge branch 'main' into derived-diamond-problem
crutchcorn Nov 25, 2024
8105722
Merge branch 'main' into derived-diamond-problem
crutchcorn Nov 25, 2024
b952bce
chore: migrate derived and effect to have cleanup and mount as distin…
crutchcorn Nov 25, 2024
9958187
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 25, 2024
b53b821
feat: add previous and current value to the store
crutchcorn Nov 25, 2024
a46d778
feat: add ability to track previous and new values of deps
crutchcorn Nov 25, 2024
cd7bb0d
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 25, 2024
0fe4628
chore: fix build
crutchcorn Nov 25, 2024
cc48436
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 25, 2024
709f04b
feat: add ability to get previous value from derived fn
crutchcorn Nov 27, 2024
f8c9839
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 27, 2024
c3b3f94
feat: add proper typings to derived state
crutchcorn Nov 27, 2024
cef42eb
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Nov 27, 2024
24a771b
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 27, 2024
ec4fcc1
chore: fix potentially faulty TState inferencing
crutchcorn Nov 27, 2024
555b7bb
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Nov 27, 2024
15ce0d4
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 27, 2024
b1fa3ad
chore: fix usage for TypeScript 4.9
crutchcorn Nov 29, 2024
ab0889d
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 29, 2024
4be2a82
chore: fix knip
crutchcorn Nov 29, 2024
e96a781
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Nov 29, 2024
bf39f70
chore: more work to support TS5
crutchcorn Nov 29, 2024
1e7fec0
chore: fix usage of import and require type
crutchcorn Nov 29, 2024
df0646d
chore!: drop TypeScript 4.9 support
crutchcorn Nov 29, 2024
7b0bdd2
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 29, 2024
d751b2d
fix: prevState now works as intended
crutchcorn Nov 29, 2024
e8ff103
chore!: remove store.batch, add in temporary scheduler, skip intentio…
crutchcorn Nov 29, 2024
5f11306
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 29, 2024
8fb38a8
chore: add working unregister from graph
crutchcorn Nov 29, 2024
ee55538
chore: hooman attempt
crutchcorn Nov 29, 2024
0be5257
chore: cursor attempt
crutchcorn Nov 29, 2024
7a41b27
chore: code cleanup and add back batch tests
crutchcorn Nov 29, 2024
dbbf664
chore: fix listener recieving old values
crutchcorn Nov 29, 2024
2b95688
chore: fix laziness
crutchcorn Nov 29, 2024
9661c17
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 29, 2024
acf03d7
chore!: fix timings and temporarily(?) remove lazy prop
crutchcorn Nov 30, 2024
7e9752f
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 30, 2024
13c472f
chore: migrate useStore in React to support Derived values stores as …
crutchcorn Nov 30, 2024
8c0e587
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 30, 2024
782e772
chore: fix CI tests
crutchcorn Nov 30, 2024
5d2e67f
chore: add Angular store Derived support
crutchcorn Nov 30, 2024
6e5156d
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 30, 2024
2baec1f
chore: fix issues with Solid store tests
crutchcorn Nov 30, 2024
ac58a5f
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 30, 2024
2c4129f
chore: fix useStore from Vue
crutchcorn Nov 30, 2024
861e8df
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Nov 30, 2024
59ab2df
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 30, 2024
9a5d485
chore: svelte works with useStore now
crutchcorn Nov 30, 2024
697d15e
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Nov 30, 2024
46e63ef
ci: apply automated fixes and generate docs
autofix-ci[bot] Nov 30, 2024
7dc64d5
chore: add demo of useStore working as-intended
crutchcorn Nov 30, 2024
34ae6b0
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Nov 30, 2024
f8c01f6
chore: fix CI
crutchcorn Nov 30, 2024
e9c449d
fix: issues with unmounting and remounting derived values
crutchcorn Dec 1, 2024
ab4c1f3
ci: apply automated fixes and generate docs
autofix-ci[bot] Dec 1, 2024
2e0bfd3
chore: add failing tests
crutchcorn Dec 1, 2024
634cbf2
fix: issues with out-of-order mounting should be fixed
crutchcorn Dec 1, 2024
e16ced5
Merge branch 'derived-diamond-problem' of https://github.com/TanStack…
crutchcorn Dec 1, 2024
4ec258b
ci: apply automated fixes and generate docs
autofix-ci[bot] Dec 1, 2024
ce6f794
chore: add tests
crutchcorn Dec 1, 2024
38558db
ci: apply automated fixes and generate docs
autofix-ci[bot] Dec 1, 2024
29af493
chore: add another failing test
crutchcorn Dec 1, 2024
cc45169
ci: apply automated fixes and generate docs
autofix-ci[bot] Dec 1, 2024
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
Prev Previous commit
Next Next commit
ci: apply automated fixes and generate docs
  • Loading branch information
autofix-ci[bot] authored and crutchcorn committed Nov 30, 2024
commit 7e9752f33fcf8623506c368f5a9df30df520c5c8
46 changes: 24 additions & 22 deletions docs/reference/classes/derived.md
Original file line number Diff line number Diff line change
@@ -29,22 +29,10 @@ new Derived<TState, TArr>(options): Derived<TState, TArr>

#### Defined in

[derived.ts:92](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L92)
[derived.ts:87](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L87)

## Properties

### hasBeenRead

```ts
hasBeenRead: boolean = false;
```

#### Defined in

[derived.ts:108](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L108)

***

### options

```ts
@@ -53,7 +41,7 @@ options: DerivedOptions<TState, TArr>;

#### Defined in

[derived.ts:69](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L69)
[derived.ts:64](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L64)

## Accessors

@@ -69,9 +57,23 @@ get prevState(): TState

`TState`

#### Set Signature

```ts
set prevState(val): void
```

##### Parameters

• **val**: `TState`

##### Returns

`void`

#### Defined in

[derived.ts:120](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L120)
[derived.ts:109](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L109)

***

@@ -89,7 +91,7 @@ get state(): TState

#### Defined in

[derived.ts:110](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L110)
[derived.ts:101](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L101)

## Methods

@@ -123,7 +125,7 @@ prevVal: undefined | NonNullable<TState>;

#### Defined in

[derived.ts:77](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L77)
[derived.ts:72](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L72)

***

@@ -143,7 +145,7 @@ mount(): () => void

#### Defined in

[derived.ts:186](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L186)
[derived.ts:172](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L172)

***

@@ -159,7 +161,7 @@ recompute(): void

#### Defined in

[derived.ts:172](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L172)
[derived.ts:161](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L161)

***

@@ -179,7 +181,7 @@ registerOnGraph(deps): void

#### Defined in

[derived.ts:124](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L124)
[derived.ts:113](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L113)

***

@@ -203,7 +205,7 @@ subscribe(listener): () => void

#### Defined in

[derived.ts:197](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L197)
[derived.ts:183](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L183)

***

@@ -223,4 +225,4 @@ unregisterFromGraph(deps): void

#### Defined in

[derived.ts:152](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L152)
[derived.ts:141](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L141)
2 changes: 1 addition & 1 deletion docs/reference/functions/batch.md
Original file line number Diff line number Diff line change
@@ -19,4 +19,4 @@ function batch(fn): void

## Defined in

[scheduler.ts:97](https://github.com/TanStack/store/blob/main/packages/store/src/scheduler.ts#L97)
[scheduler.ts:100](https://github.com/TanStack/store/blob/main/packages/store/src/scheduler.ts#L100)
22 changes: 1 addition & 21 deletions docs/reference/interfaces/derivedoptions.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ deps: TArr;

#### Defined in

[derived.ts:52](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L52)
[derived.ts:47](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L47)

***

@@ -43,26 +43,6 @@ Values of the `deps` from before and after the current invocation of `fn`

#### Defined in

[derived.ts:56](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L56)

***

### lazy?

```ts
optional lazy: boolean;
```

Should the value of `Derived` only be computed once it is accessed

#### Default

```ts
false
```

#### Defined in

[derived.ts:51](https://github.com/TanStack/store/blob/main/packages/store/src/derived.ts#L51)

***