Repository navigation
Conversation
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2595 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 31 31
Lines 719 719
Branches 223 223
=========================================
Hits 719 719 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vtushar06
approved these changes
Nov 13, 2026
vtushar06
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, the named handler and removeEventListener on unmount match what we already do in Layout.tsx.
|
Congratulations, @Sarthak-Pandey for your first pull request merge in this repository! 🎉🎉. Thanks for your contribution to JSON Schema! |
This branch was successfully deployed
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.
What kind of change does this PR introduce?
Bugfix
Issue Number:
Screenshots/videos:
N/A (Behavioral cleanup of background event listeners)
If relevant, did you update the documentation?
N/A
Summary
In
components/Sidebar.tsx, theSidebarLayoutcomponent attached a resize event listener towindowusing an anonymous function inside auseEffect, but did not return a cleanup function to remove it on unmount.Consequently, whenever navigating between pages mounting
SidebarLayout, new listeners accumulated onwindow, leading to potential memory leaks and redundant callback execution on viewport resize. Additionally, the dependency array[typeof window !== 'undefined']evaluated to a constant[true]on the client side.This PR fixes the issue by:
handleResize) and returningwindow.removeEventListener('resize', handleResize)to clean it up on unmount.[typeof window !== 'undefined']with[].if (window)guard sinceuseEffectexclusively runs client-side post-mount.This matches the existing cleanup pattern used in
components/Layout.tsx.Does this PR introduce a breaking change?
No
Checklist
Please ensure the following tasks are completed before submitting this pull request.