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

Debounce: make it possible to inmediately return the initial value #990

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BoussonKarel
Copy link
Contributor

Use case:

  • You have a computed property, for instance a query, which gets updated by some filters in your UI.
  • The initial debouncedQuery should be set to the value of query, and updates after that should be debounced by x ms

@stackblitz
Copy link

stackblitz bot commented Sep 5, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@changeset-bot
Copy link

changeset-bot bot commented Sep 5, 2023

⚠️ No Changeset found

Latest commit: 42673f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@NullVoxPopuli
Copy link
Owner

any chance you can rebase? just merged something that'll fix parts of CI

let lastValue: Value;
let timer: number;
let state = new TrackedValue<Value>();

/**
* Whether the initial value has been returned inmediately or not
Copy link
Owner

Choose a reason for hiding this comment

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

perhaps? https://limber.glimdown.com/edit?c=AYjmCsGcAIBsEsBuBTAUPAtgBwPYCcAXaAYR2xwDtkKiAzPM6AcgAFQEMNk8B6AYzK4qNJgG505QtADe0PMkg4Arnj7IAYgEM%2BBfAE8ANHIXLVyI0sjnoa2LGgBfaPUZNkGAEbcAtPMUq1SDEJXClZAjxtAGtkABNHZwYMZgjouO8PJXhYAm94CiDxTFCiWUoEl2TWdy9eDBxY%2BFp4bmDi-FLobQJ4cqdK5hYa7h4cD3BkHWDUZAAPEuclCh1eimhY5A9lZeQACgxIIwIACyWoo3z4Hs0EAC9kAEoZVGg4ZCJYTUgCADUbpWQ4lesHe0G%2BmgIyGgA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eBOzs8g8WIsw7k89BznwzsPnJTKs3O3LavLL3yr3zxsCvcVnE1WvKkvqdHUDplm2dKkBgCAA&format=glimdown

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.

2 participants