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

handle rxjs-style observables with get_store_value #3170

Merged
merged 1 commit into from
Jul 6, 2019
Merged

Conversation

Rich-Harris
Copy link
Member

fixes #3153

export function get_store_value<T>(store: Readable<T>): T | undefined {
let value;
store.subscribe(_ => value = _)();
const unsubscribe: any = store.subscribe(_ => value = _);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out how to do this properly in TypeScript, hence any

@Rich-Harris Rich-Harris merged commit 1056951 into master Jul 6, 2019
@Rich-Harris Rich-Harris deleted the gh-3153 branch July 6, 2019 18:43
@bvl12
Copy link

bvl12 commented Jul 11, 2019

Even after this fix, svelte still has a problem unsubscribing from rxjs observables. Any idea what this problem could be?

Minimal repl: https://svelte.dev/repl/8bf28363bde34ecb8fa4e9b91a9e397a?version=3.6.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_store_value doesn't account for RxJS observables
2 participants