Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix #1571

Steven Tey27df79e3d169
diff --git a/apps/web/package.json b/apps/web/package.json
index c28b603c0b..35546e7d66 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -110,7 +110,7 @@
"topojson-client": "^3.1.0",
"unique-names-generator": "^4.7.1",
"unsplash-js": "^7.0.18",
- "use-debounce": "^8.0.4",
+ "use-debounce": "^10.0.4",
"vaul": "^0.6.8",
"zod": "^3.22.4",
"zod-error": "^1.5.0",
diff --git a/apps/web/ui/modals/link-qr-modal.tsx b/apps/web/ui/modals/link-qr-modal.tsx
index db93fdcc91..601e71a5b2 100644
--- a/apps/web/ui/modals/link-qr-modal.tsx
+++ b/apps/web/ui/modals/link-qr-modal.tsx
@@ -40,6 +40,7 @@ import {
} from "react";
import { HexColorInput, HexColorPicker } from "react-colorful";
import { toast } from "sonner";
+import { useDebouncedCallback } from "use-debounce";
const DEFAULT_COLORS = [
"#000000",
@@ -124,6 +125,11 @@ function LinkQRModalInner({
[url, data, hideLogo, logo],
);
+ const onColorChange = useDebouncedCallback(
+ (color: string) => setData((d) => ({ ...d, fgColor: color })),
+ 500,
+ );
+
return (
<form
className="flex flex-col gap-6 p-4"
@@ -274,9 +280,7 @@ function LinkQRModalInner({
<div className="flex max-w-xs flex-col items-center space-y-3 p-5 text-center">
<HexColorPicker
color={data.fgColor}
- onChange={(color) => {
- setData((d) => ({ ...d, fgColor: color }));
- }}
+ onChange={onColorChange}
/>
</div>
}
@@ -293,7 +297,7 @@ function LinkQRModalInner({
id="color"
name="color"
color={data.fgColor}
- onChange={(color) => setData((d) => ({ ...d, fgColor: color }))}
+ onChange={onColorChange}
prefixed
style={{ borderColor: data.fgColor }}
className="block w-full rounded-r-md border-2 border-l-0 pl-3 text-gray-900 placeholder-gray-400 focus:outline-none focus:ring-black sm:text-sm"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e06aafddf9..21151cc6f0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -327,8 +327,8 @@ importers:
specifier: ^7.0.18
version: 7.0.18
use-debounce:
- specifier: ^8.0.4
- version: 8.0.4([email protected])
+ specifier: ^10.0.4
+ version: 10.0.4([email protected])
vaul:
specifier: ^0.6.8
@@ -21674,6 +21674,15 @@ packages:
react: 18.2.0
dev: false
+ resolution: {integrity: sha512-6Cf7Yr7Wk7Kdv77nnJMf6de4HuDE4dTxKij+RqE9rufDsI6zsbjyAxcH5y2ueJCQAnfgKbzXbZHYlkFwmBlWkw==}
+ engines: {node: '>= 16.0.0'}
+ peerDependencies:
+ react: '*'
+ dependencies:
+ react: 18.2.0
+ dev: false
+
resolution: {integrity: sha512-fGqsYQzl8kLHF2QpQSgIwgOgJmnh6j5L6SIzQiHdLfwp3q1egUL3btq5Bg2SJysH6A0ILLgT2IqXZKoNJr0nFw==}
engines: {node: '>= 10.0.0'}