Skip to content

fix: Replace usehooks-ts by @mantine/hooks to solve CSP error (#80)#83

Merged
CrawlerCode merged 1 commit intobetafrom
fix/firefox-csp-error
Apr 29, 2026
Merged

fix: Replace usehooks-ts by @mantine/hooks to solve CSP error (#80)#83
CrawlerCode merged 1 commit intobetafrom
fix/firefox-csp-error

Conversation

@CrawlerCode
Copy link
Copy Markdown
Owner

The root cause of the issues was the lodash.debounce package, which uses Function('return this')(), that was blocked by the Content Security Policy in firefox.

The root cause of the issues was the `lodash.debounce` package, which uses `Function(‘return this’)()`, that was blocked by the Content Security Policy in firefox.
Copy link
Copy Markdown

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 replaces usehooks-ts hooks with @mantine/hooks equivalents to eliminate a Firefox CSP violation introduced via lodash.debounce (used by usehooks-ts).

Changes:

  • Swap useMediaQuery imports to @mantine/hooks in routes using responsive layout logic.
  • Replace useInterval usage with Mantine’s interval API (start/stop) in timer components.
  • Remove custom useDebounce hook in favor of Mantine’s useDebouncedValue, and drop usehooks-ts (and transitive lodash.debounce) from dependencies.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/routes/timers.tsx Switch useMediaQuery to Mantine to avoid CSP-breaking dependency chain.
src/routes/issues.tsx Same useMediaQuery replacement as timers route.
src/hooks/useDebounce.ts Removes now-unneeded local debounce hook.
src/components/timer/timer/TimerSessions.tsx Replace useInterval implementation to Mantine start/stop API for active session ticking.
src/components/timer/timer/TimerRoot.tsx Same interval migration for total elapsed time ticking.
src/components/issue/IssueSearch.tsx Replace local debounce usage with Mantine useDebouncedValue.
package.json Add @mantine/hooks, remove usehooks-ts.
pnpm-lock.yaml Lockfile updates reflecting dependency swap and removal of lodash.debounce.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread src/components/timer/timer/TimerRoot.tsx
Comment thread src/components/timer/timer/TimerSessions.tsx
@CrawlerCode CrawlerCode changed the base branch from main to beta April 29, 2026 15:36
@CrawlerCode CrawlerCode merged commit 65e2a22 into beta Apr 29, 2026
31 checks passed
@CrawlerCode CrawlerCode deleted the fix/firefox-csp-error branch April 29, 2026 15:38
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