Closed pengyin-shan closed 3 months ago
Name | Link |
---|---|
Latest commit | 5acf942bbf955acebd8047dda379ad1d616abd89 |
Latest deploy log | https://app.netlify.com/sites/cheerful-treacle-913a24/deploys/66bf8d4c42f5d2000852d85d |
Deploy Preview | https://deploy-preview-260--cheerful-treacle-913a24.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
This PR addresses the issue of infinite re-rendering in
DiscoverArea
and its subcomponents, which can be observed by adding a console log in the component. The root cause was theuseEffect
inindex.tsx
, which is responsible for providingsolrObjectResults
to all components inDiscoverArea
. Without dependencies, theuseEffect
was running on every render, causingsetSolrObjectResults
and other state setters to trigger additional renders, leading to the infinite loop.I've added solrUrl and schema as dependencies, ensuring that
<DiscoverArea>
and its subcomponents only re-render when these two variables change. I also cleaned up some unused code inindex.tsx
after making this change.How to Test
Run the app and navigate to the search page. You should observe only two render cycles, as indicated by the console message in the
ResultPanel
component. The two renders are expected in development; in production, it should render only once.Please let me know if this makes sense to you. Please feel free to add more test messages to confirm the fix.