Skip to content

Surya4419/i330/unnecessary re render on sample selection #338

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

surya4419
Copy link
Contributor

Optimize "Load Sample" Dropdown to Prevent Unnecessary Re-renders

Closes #330

Summary

This PR optimizes the "Load Sample" dropdown functionality to ensure that only the relevant components update instead of causing a full re-render of the body section. This improves performance, reduces unnecessary API calls, and prevents UI flickering.

Changes

  • Refactored state management to prevent full re-renders.
    -Used debounced validation to prevent excessive re-renders
  • Ensured that selecting a sample only updates the editor/preview without reloading the entire UI.

Screenshots or Video

(Attach any relevant screenshots or a video demonstrating the optimized behavior.)
Before

before.mp4

After

after.mp4

Related Issues

Author Checklist

  • Signed off commits using --signoff.
  • Added unit tests for the changes.
  • Commit messages follow AP format.
  • Updated relevant documentation if necessary.

@surya4419 surya4419 requested a review from a team as a code owner March 28, 2025 15:42
Copy link

netlify bot commented Mar 28, 2025

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit 732c6eb
🔍 Latest deploy log https://app.netlify.com/sites/ap-template-playground/deploys/67ed1360ceab63000847c909
😎 Deploy Preview https://deploy-preview-338--ap-template-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@surya4419
Copy link
Contributor Author

Hey @DianaLease @sanketshevkar , could you please review my PR when you get a chance? I’ve optimized the 'Load Sample' dropdown to prevent unnecessary re-renders and improve performance. Let me know if you have any feedback. Thanks

…mple dropdown

Signed-off-by: surya4419 <suryaa4419@gmail.com>
…mple dropdown

Signed-off-by: surya4419 <suryaa4419@gmail.com>
@surya4419 surya4419 force-pushed the surya4419/i330/Unnecessary-Re-render-on-Sample-Selection branch from df09853 to bd2f8da Compare March 30, 2025 05:47
Copy link
Member

@sanketshevkar sanketshevkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preview output window goes blank after we change the template. I think that's why we had a loader earlier.

…mple dropdown

Signed-off-by: surya4419 <suryaa4419@gmail.com>
…mple dropdown

Signed-off-by: surya4419 <suryaa4419@gmail.com>
@surya4419
Copy link
Contributor Author

Hi @sanketshevkar ,could you please review my PR when you get a chance?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full Body Re-renders When Selecting a Sample from "Load Sample" Dropdown
3 participants