Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

➖ Remove lodash (#3472)

Luke Vella98822fb2c6be
diff --git a/apps/landing/package.json b/apps/landing/package.json
index 9e8e267f8..c51933b39 100644
--- a/apps/landing/package.json
+++ b/apps/landing/package.json
@@ -29,7 +29,6 @@
"i18next-resources-to-backend": "^1.2.1",
"intl-messageformat": "^10.7.15",
"js-cookie": "^3.0.1",
- "lodash": "^4.17.21",
"lucide-react": "^0.479.0",
"motion": "^12.6.2",
"nanoid": "^5.0.9",
@@ -48,7 +47,6 @@
"@rallly/tsconfig": "workspace:*",
"@types/color-hash": "^1.0.2",
"@types/js-cookie": "^3.0.1",
- "@types/lodash": "^4.14.178",
"@types/node": "^24.1.0",
"@types/react": "19.2.13",
"@types/react-dom": "19.2.3",
diff --git a/apps/web/package.json b/apps/web/package.json
index b1e225609..22598409d 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -78,7 +78,6 @@
"iron-session": "^6.3.1",
"js-cookie": "^3.0.1",
"linkify-react": "^4.3.2",
- "lodash": "^4.17.21",
"lucide-react": "^0.479.0",
"micro": "^10.0.1",
"motion": "^12.6.2",
@@ -114,7 +113,6 @@
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@types/js-cookie": "^3.0.1",
- "@types/lodash": "^4.14.178",
"@types/node": "^24.1.0",
"@types/react": "19.2.13",
"@types/react-dom": "19.2.3",
diff --git a/apps/web/src/components/search-input.tsx b/apps/web/src/components/search-input.tsx
index c685b29d9..3f8f7ed97 100644
--- a/apps/web/src/components/search-input.tsx
+++ b/apps/web/src/components/search-input.tsx
@@ -6,7 +6,6 @@ import {
InputGroupAddon,
InputGroupInput,
} from "@rallly/ui/input-group";
-import debounce from "lodash/debounce";
import { SearchIcon } from "lucide-react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import React from "react";
@@ -38,33 +37,42 @@ export function SearchInput({
const [isPending, startTransition] = React.useTransition();
const isSearching = isDebouncing || isPending;
- // Create a debounced function to update the URL
- // biome-ignore lint/correctness/useExhaustiveDependencies: Fix this later
- const debouncedUpdateUrl = React.useCallback(
- debounce((value: string) => {
- const params = new URLSearchParams(searchParams);
- if (value) {
- params.set("q", value);
- } else {
- params.delete("q");
- }
+ const updateUrl = (value: string) => {
+ const params = new URLSearchParams(searchParams);
+ if (value) {
+ params.set("q", value);
+ } else {
+ params.delete("q");
+ }
- params.delete("page");
+ params.delete("page");
- setIsDebouncing(false);
- startTransition(() => {
- router.replace(`${pathname}?${params.toString()}`, { scroll: false });
- });
- }, 500),
- [pathname, router, searchParams],
- );
+ setIsDebouncing(false);
+ startTransition(() => {
+ router.replace(`${pathname}?${params.toString()}`, { scroll: false });
+ });
+ };
+
+ // Debounce URL updates while typing; submitting flushes the pending value
+ const pendingValue = React.useRef<string | null>(null);
+ const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);
+
+ const flushUpdate = () => {
+ clearTimeout(timer.current);
+ if (pendingValue.current === null) return;
+ const value = pendingValue.current;
+ pendingValue.current = null;
+ updateUrl(value);
+ };
// Handle input changes
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newValue = e.target.value;
setInputValue(newValue);
setIsDebouncing(true);
- debouncedUpdateUrl(newValue);
+ pendingValue.current = newValue;
+ clearTimeout(timer.current);
+ timer.current = setTimeout(flushUpdate, 500);
};
return (
@@ -72,7 +80,7 @@ export function SearchInput({
className={cn("w-72", className)}
onSubmit={(e) => {
e.preventDefault();
- debouncedUpdateUrl.flush();
+ flushUpdate();
}}
>
<InputGroup>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 012ba877c..5dde9737c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -97,7 +97,7 @@ importers:
version: 8.1.0([email protected])
'@vercel/analytics':
specifier: ^1.5.0
dayjs:
specifier: ^1.11.13
version: 1.11.19
@@ -119,9 +119,6 @@ importers:
js-cookie:
specifier: ^3.0.1
version: 3.0.5
- lodash:
- specifier: ^4.17.21
- version: 4.17.23
lucide-react:
specifier: ^0.479.0
version: 0.479.0([email protected])
@@ -139,7 +136,7 @@ importers:
version: 6.0.0(@types/[email protected])([email protected])
next-seo:
specifier: ^6.1.0
pg:
specifier: ^8.17.1
version: 8.18.0
@@ -171,9 +168,6 @@ importers:
'@types/js-cookie':
specifier: ^3.0.1
version: 3.0.6
- '@types/lodash':
- specifier: ^4.14.178
- version: 4.17.23
'@types/node':
specifier: ^24.1.0
version: 24.10.11
@@ -369,9 +363,6 @@ importers:
linkify-react:
specifier: ^4.3.2
- lodash:
- specifier: ^4.17.21
- version: 4.17.23
lucide-react:
specifier: ^0.479.0
version: 0.479.0([email protected])
@@ -472,9 +463,6 @@ importers:
'@types/js-cookie':
specifier: ^3.0.1
version: 3.0.6
- '@types/lodash':
- specifier: ^4.14.178
- version: 4.17.23
'@types/node':
specifier: ^24.1.0
version: 24.10.11
@@ -6736,9 +6724,6 @@ packages:
resolution: {integrity: sha512-7QFsywoE5URbuVnG3loe03QXuGajrnotr3gQkXcEBShORai23MePfFYdhz90FEtBBpkyIYQbVD+evKtloCgX3g==}
- '@types/[email protected]':
- resolution: {integrity: sha512-RDvF6wTulMPjrNdCoYRC8gNR880JNGT8uB+REUpC2Ns4pRqQJhGz90wh7rgdXDPpCczF3VGktDuFGVnz8zP7HA==}
-
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
@@ -19834,8 +19819,6 @@ snapshots:
'@types/koa-compose': 3.2.9
'@types/node': 24.10.11
- '@types/[email protected]': {}
-
dependencies:
'@types/unist': 3.0.3
@@ -20036,9 +20019,9 @@ snapshots:
dependencies:
uncrypto: 0.1.3
optionalDependencies:
react: 19.2.6
@@ -24130,9 +24113,9 @@ snapshots:
react: 19.2.6
react-dom: 19.2.6([email protected])
dependencies:
react: 19.2.6
react-dom: 19.2.6([email protected])
@@ -24168,33 +24151,6 @@ snapshots:
- '@types/node'
- babel-plugin-macros
- dependencies:
- '@next/env': 16.3.8
- '@swc/helpers': 0.5.23
- baseline-browser-mapping: 2.11.26
- caniuse-lite: 1.0.30001813
- postcss: 8.5.23
- react: 19.2.6
- react-dom: 19.2.6([email protected])
- styled-jsx: 5.1.6(@babel/[email protected])([email protected])
- optionalDependencies:
- '@next/swc-darwin-arm64': 16.3.8
- '@next/swc-darwin-x64': 16.3.8
- '@next/swc-linux-arm64-gnu': 16.3.8
- '@next/swc-linux-arm64-musl': 16.3.8
- '@next/swc-linux-x64-gnu': 16.3.8
- '@next/swc-linux-x64-musl': 16.3.8
- '@next/swc-win32-arm64-msvc': 16.3.8
- '@next/swc-win32-x64-msvc': 16.3.8
- '@opentelemetry/api': 1.9.0
- '@playwright/test': 1.58.1
- sharp: 0.35.5(@types/[email protected])
- transitivePeerDependencies:
- - '@babel/core'
- - '@types/node'
- - babel-plugin-macros
-
dependencies:
'@next/env': 16.3.8