refactor: extract duplicated code patterns into shared utilities - #2
Closed
devin-ai-integration[bot] wants to merge 2 commits into
Closed
refactor: extract duplicated code patterns into shared utilities#2devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Description
Extracts several duplicated code patterns into shared utilities/hooks:
src/utils/useResponsiveSlider.js— shared react-slick slider lifecycle (client detection, viewport-basedslidesToShow, debounced resize/load handling, optional image-load listeners,innerSlider.onWindowResized()refresh, cleanup). Adopted by:src/components/Related-Posts/index.jssrc/sections/Home/So-Special-Section/index.jssrc/sections/Pricing/review-slider.js(keeps its.slider imgload listeners viawatchImagesSelector)computeSlidescallback.src/utils/useScrollTiltEffect.js— shared scroll-drivenrotateX()tilt effect previously duplicated insrc/sections/FeatureHero/index.jsandsrc/sections/SolutionHero/index.js.src/utils/usePaginatedSearch.js— combines the existinguseDataListsearch with page-based slicing; replaces identical state/slicing blocks insrc/pages/blog/index.js,src/templates/blog-category-list.js, andsrc/templates/blog-tag-list.js(same defaults:["frontmatter", "title"],"id", 10 per page).src/sections/Company/Legal/legal-table.style.js— shared Sistent table styles (StyledTableContainer,StyledTableRow,StyledTableCell,StyledHeaderCell) andlegalTableTheme, previously duplicated in the privacy, cookie-notice, and sub-processors pages.Behavior is unchanged; only duplication is consolidated.
Notes for Reviewers
.lintstagedrc.js) needed two fixes to be able to commit at all:--no-warn-ignoredadded to the eslint step: eslint's "File ignored" warnings forsrc/utils/files (which are in the eslint ignore list) tripped--max-warnings=0, blocking any commit touchingsrc/utils/.eslint --fixinstead of after: prettier's output violates the repo's eslintindentrules, so the previous order produced commits that failnpm run checklint(CI). With eslint last, committed files are eslint-clean.eslintpasses on all touched files;npm run build(full Gatsby build) also runs in CI.Signed commits
Link to Devin session: https://app.devin.ai/sessions/2d082449c65546d48e3c44d4e65abd3f
Requested by: @NSTKrishna