Repository navigation
Stop ES modules from waiting forever on modules that never load - #83
Merged
Merged
Conversation
A module waited for every earlier name, also for names whose widget was closed, and a redefinition picked up the names defined after it, so re-running a cell made a dependency cycle. In the browser, a code change during a pending load dropped the resolver that consumers were waiting on, and a slow stale load could overwrite newer code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A widget's default _dependencies listed every module name, so after a page reload it waited forever for a module whose widget was closed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rides ipyvue 3 (pulled in by solara 1.64) sets esmsInitOptions without mapOverrides, so the shared es-module-shims keeps the first url for a module name and consumers of a recreated or updated Module kept importing the old code. Consumers of a Module widget's name now take the module from the registry, which every load updates. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Stops ES modules and widgets from waiting forever for modules that never load, and adds
dependencies=todefine_module, as in ipyvue.Problem
define_modulemakes each module wait for every module name defined earlier in the Python process, and each widget waits for all of them too.That list never forgets a name, so three cases hang with no error:
aandbruns again. The secondawaits forband the secondbwaits fora; after a page reload both wait forever.App authors also cannot say what a module really needs. The same fixes were reviewed in ipyvue (#106, #108).
Change
define_module(name, module=None, *, code=None, url=None, dependencies=None): an explicit list is used as given; without it the default is unchanged except that it skips modules whose widget is closed._dependenciesalso skips closed modules._moduleis a Module widget's name takes the module from the registry instead ofimportShim(name). ipyvue 3.0.0 (pulled in by solara 1.64) setsesmsInitOptionswithoutmapOverrides, so the shared es-module-shims rejects a remap and a recreated module kept serving the old code. This madetest_module_recreated_widget_hot_reloadfail on CI for master too, not only for this PR.Validation
tests/unit/define_module_test.py: new tests for explicit dependencies, closed modules skipped (modules and widgets), and redefinition. 9 passed; the new ones fail on the old code.tests/ui/module_hot_reload_test.py::test_module_code_change_while_pending: a widget waits for a module whose code changes before its dependency arrives, and must show the new code. It passes with the fix and times out on master.npm run build:prodpasses.Gaps
mapOverridesand fixes that once released.define_module; widgetti/solara#1244 addsdependencies=there.Align results
Caution
/alignwas not run on this change: the interface (ipyreact parity with ipyvue, explicitdependencies=overrides the default) was settled with the maintainer in the ipyvue review session.Crossreview results
_dependenciesskip closed modules) was added by the driver before review and is covered by a unit test. 2ec94ea (consumers take a Module widget's name from the registry, 6 lines) was added after review to fix the CI failure above; the driver confirmed it, andtests/ui/module_hot_reload_test.pypasses in CI.🤖 Generated with Claude Code