Skip to content

Conversation

@maartenbreddels
Copy link
Contributor

Summary

  • Adds solara.create_reload_checker() which returns a function that detects when a hot reload has occurred
  • Useful for long-running tasks (threads, async tasks) that need to exit gracefully after a reload to avoid issues with stale references to old module state
  • Added documentation in the reloading reference page and in the task decorator docstring

Usage

import solara

did_reload = solara.create_reload_checker()

while not did_reload():
    # do work...
    await asyncio.sleep(1)
# Task exits gracefully after hot reload

Test plan

  • Added unit test for create_reload_checker()
  • All existing reload tests pass

Closes #1103

🤖 Generated with Claude Code

…unning tasks

Adds solara.create_reload_checker() which returns a function that detects
when a hot reload has occurred. This is useful for long-running tasks
(threads, async tasks) that need to exit gracefully after a reload to
avoid issues with stale references to old module state.

Closes #1103

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Hot reload with long running tasks

2 participants