fix: Replace usehooks-ts by @mantine/hooks to solve CSP error (#80)#83
Merged
CrawlerCode merged 1 commit intobetafrom Apr 29, 2026
Merged
fix: Replace usehooks-ts by @mantine/hooks to solve CSP error (#80)#83CrawlerCode merged 1 commit intobetafrom
CrawlerCode merged 1 commit intobetafrom
Conversation
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.
There was a problem hiding this comment.
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
useMediaQueryimports to@mantine/hooksin routes using responsive layout logic. - Replace
useIntervalusage with Mantine’s interval API (start/stop) in timer components. - Remove custom
useDebouncehook in favor of Mantine’suseDebouncedValue, and dropusehooks-ts(and transitivelodash.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The root cause of the issues was the
lodash.debouncepackage, which usesFunction('return this')(), that was blocked by the Content Security Policy in firefox.