Skip to content

enhance: useDebounce() returns [val, isPending]#3459

Merged
ntucker merged 1 commit intomasterfrom
usedebounce
Apr 7, 2025
Merged

enhance: useDebounce() returns [val, isPending]#3459
ntucker merged 1 commit intomasterfrom
usedebounce

Conversation

@ntucker
Copy link
Collaborator

@ntucker ntucker commented Apr 7, 2025

Previously added to /next in #3220

Motivation

Provider a better search experience out of the box. Don't flash loading in results - continue showing the previous results while new content loads.

Before

debounced-before.mp4

After

debounced-transition.mp4

Solution

import { useDebounce } from '@data-client/react';
const [debouncedQuery, isPending] = useDebounce(query, 100);

This was previously exported in @data-client/react/next to make migrations easy. This will
still be available there.

Before

import { useDebounce } from '@data-client/react';
const debouncedQuery = useDebounce(query, 100);

After

import { useDebounce } from '@data-client/react';
const [debouncedQuery] = useDebounce(query, 100);

Before

import { useDebounce } from '@data-client/react/next';
const [debouncedQuery, isPending] = useDebounce(query, 100);

After

import { useDebounce } from '@data-client/react';
const [debouncedQuery, isPending] = useDebounce(query, 100);

@changeset-bot
Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: 337b92c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@data-client/react Major
@data-client/img Major
@data-client/test Major
test-bundlesize Patch
coinbase-lite Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2025

Size Change: 0 B

Total Size: 77.8 kB

ℹ️ View Unchanged
Filename Size
examples/test-bundlesize/dist/App.js 3.42 kB
examples/test-bundlesize/dist/polyfill.js 311 B
examples/test-bundlesize/dist/rdcClient.js 10.2 kB
examples/test-bundlesize/dist/rdcEndpoint.js 5.65 kB
examples/test-bundlesize/dist/react.js 57.5 kB
examples/test-bundlesize/dist/webpack-runtime.js 726 B

compressed-size-action

@codecov
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.75%. Comparing base (d44d36a) to head (337b92c).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3459   +/-   ##
=======================================
  Coverage   98.74%   98.75%           
=======================================
  Files         125      125           
  Lines        2238     2241    +3     
  Branches      459      460    +1     
=======================================
+ Hits         2210     2213    +3     
  Misses         13       13           
  Partials       15       15           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ntucker ntucker merged commit 997ca20 into master Apr 7, 2025
22 checks passed
@ntucker ntucker deleted the usedebounce branch April 7, 2025 23:11
@github-actions github-actions bot mentioned this pull request Apr 7, 2025
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.

1 participant