From 2f9fa6f1aa34167135b59b8189b9e745fdba0131 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Thu, 4 May 2023 15:32:33 +0200 Subject: [PATCH] fix, changelog --- CHANGELOG.md | 1 + src/runtime/store/index.ts | 16 +--------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ad9a97b43..53191504a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * **breaking** Overhaul and drastically improve creating custom elements with Svelte (see PR for list of changes and migration instructions) ([#8457](https://github.com/sveltejs/svelte/pull/8457)) * **breaking** Deprecate `SvelteComponentTyped`, use `SvelteComponent` instead ([#8512](https://github.com/sveltejs/svelte/pull/8512)) * **breaking** Error on falsy values instead of stores passed to `derived` ([#7947](https://github.com/sveltejs/svelte/pull/7947)) +* **breaking** Custom store implementers now need to pass an `update` function additionally to the `set` function ([#6750](https://github.com/sveltejs/svelte/pull/6750)) * Add `a11y no-noninteractive-element-interactions` rule ([#8391](https://github.com/sveltejs/svelte/pull/8391)) * Add `a11y-no-static-element-interactions`rule ([#8251](https://github.com/sveltejs/svelte/pull/8251)) * Bind `null` option and input values consistently ([#8312](https://github.com/sveltejs/svelte/issues/8312)) diff --git a/src/runtime/store/index.ts b/src/runtime/store/index.ts index ac6b614f1a..0a80777557 100644 --- a/src/runtime/store/index.ts +++ b/src/runtime/store/index.ts @@ -137,20 +137,6 @@ type StoresValues = T extends Readable ? U : initial_value?: T ): Readable; -/** - * Derived value store by synchronizing one or more readable stores and - * applying an aggregation function over its input values. - * - * @param stores - input stores - * @param fn - function callback that aggregates the values - * @param initial_value - when used asynchronously - */ -export function derived( - stores: S, - fn: (values: StoresValues, set: Subscriber) => Unsubscriber | void, - initial_value?: T -): Readable; - /** * Derived value store by synchronizing one or more readable stores and * applying an aggregation function over its input values. @@ -186,7 +172,7 @@ export function derived(stores: Stores, fn: Function, initial_value?: T): Rea const auto = fn.length < 2; - return readable(initial_value, (set) => { + return readable(initial_value, (set, update) => { let started = false; const values = [];