Skip to content

Fix custom component reload mode#12968

Merged
freddyaboulton merged 4 commits intomainfrom
12965-fix-custom-components-reload-mode
Mar 6, 2026
Merged

Fix custom component reload mode#12968
freddyaboulton merged 4 commits intomainfrom
12965-fix-custom-components-reload-mode

Conversation

@freddyaboulton
Copy link
Collaborator

Description

The problem was that the custom component was only being mounted once so prop updates were not being propagated down to the component. So my fix was to modify the $effect in MountCustomComponent. Also, instead of using onDestroy, I am returning a function from $effect to do the cleanup.

Closes: #12965

Screenshot 2026-03-04 at 9 16 30 AM

AI Disclosure

We encourage the use of AI tooling in creating PRs, but the any non-trivial use of AI needs be disclosed. E.g. if you used Claude to write a first draft, you should mention that. Trivial tab-completion doesn't need to be disclosed. You should self-review all PRs, especially if they were generated with AI.

  • I used AI to... [fill here]
  • I did not use AI

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Testing and Formatting Your Code

  1. PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests: bash scripts/run_backend_tests.sh

  2. Please run these bash scripts to automatically format your code: bash scripts/format_backend.sh, and (if you made any changes to non-Python files) bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Mar 4, 2026

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/6b521bb8e0b3db455bc2c1199e2c52d81b639fa8/gradio-6.8.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@6b521bb8e0b3db455bc2c1199e2c52d81b639fa8#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/6b521bb8e0b3db455bc2c1199e2c52d81b639fa8/gradio-client-2.1.0.tgz

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Mar 4, 2026

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/core patch
gradio patch

  • Fix custom component reload mode

✅ Changeset approved by @freddyaboulton

  • Maintainers can remove approval by unchecking this checkbox.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@freddyaboulton freddyaboulton marked this pull request as ready for review March 4, 2026 21:49
@freddyaboulton freddyaboulton requested a review from pngwn March 4, 2026 21:49
let runtime = $derived(
(await node.runtime) as {
mount: typeof import("svelte").mount;
umount: typeof import("svelte").unmount;
Copy link
Member

Choose a reason for hiding this comment

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

uuuuumount

Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

This looks great. Thanks for the clean fix @freddyaboulton!

@freddyaboulton freddyaboulton merged commit fe95534 into main Mar 6, 2026
22 of 23 checks passed
@freddyaboulton freddyaboulton deleted the 12965-fix-custom-components-reload-mode branch March 6, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

custom component dev reload not working

3 participants