Skip to content

Comments

fix: replace full lodash imports with per-function imports#3776

Open
karyanayandi wants to merge 1 commit intoDokploy:canaryfrom
karyanayandi:fix/replace-full-lodash-imports
Open

fix: replace full lodash imports with per-function imports#3776
karyanayandi wants to merge 1 commit intoDokploy:canaryfrom
karyanayandi:fix/replace-full-lodash-imports

Conversation

@karyanayandi
Copy link

@karyanayandi karyanayandi commented Feb 22, 2026

What is this PR about?

Importing the entire lodash library adds ~70kb to the bundle. Switch to specific imports (lodash/debounce, lodash/escapeRegExp) so only the used functions are included.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

Screenshots (if applicable)

Greptile Summary

Replaced full lodash imports with specific function imports (lodash/debounce, lodash/escapeRegExp) across 4 frontend component files to reduce bundle size by approximately 70kb.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward import refactoring with no logic changes - simply replacing full lodash imports with specific function imports, which is a best practice for bundle optimization
  • No files require special attention

Last reviewed commit: 0b1c1e8

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

Importing the entire lodash library adds ~70kb to the bundle. Switch to
specific imports (lodash/debounce, lodash/escapeRegExp) so only the used
functions are included.
Copilot AI review requested due to automatic review settings February 22, 2026 13:36
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to reduce client bundle size by replacing full lodash imports with per-function imports so only the required utilities are included in the build.

Changes:

  • Replaced import _ from "lodash" + _.escapeRegExp with import escapeRegExp from "lodash/escapeRegExp".
  • Replaced import { debounce } from "lodash" / _.debounce with import debounce from "lodash/debounce" across several components.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
apps/dokploy/components/dashboard/docker/logs/terminal-line.tsx Switches to lodash/escapeRegExp for regex escaping used in log highlighting.
apps/dokploy/components/dashboard/docker/logs/line-count-filter.tsx Switches debounce import to lodash/debounce to avoid full lodash import.
apps/dokploy/components/dashboard/database/backups/restore-backup.tsx Replaces lodash default import with lodash/debounce and updates usage.
apps/dokploy/components/dashboard/application/volume-backups/restore-volume-backups.tsx Switches debounce import to lodash/debounce.
Comments suppressed due to low confidence (1)

apps/dokploy/components/dashboard/database/backups/restore-backup.tsx:243

  • debouncedSetSearch is created on every render. Because lodash debounce maintains internal timers, this can defeat debouncing (multiple independent timers can fire) and may cause state updates after unmount. Make the debounced function stable (e.g., via useMemo/useRef) and cancel it in an effect cleanup.
	const debouncedSetSearch = debounce((value: string) => {
		setDebouncedSearchTerm(value);
	}, 350);

	const handleSearchChange = (value: string) => {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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