Skip to content

Ensure ESM model definition can be loaded dynamically - #8432

Merged
philippjfr merged 1 commit into
mainfrom
esm_model_defs
Feb 24, 2026
Merged

philippjfr merged 1 commit into
mainfrom
esm_model_defs

Conversation

@philippjfr

@philippjfr philippjfr commented Feb 23, 2026

Copy link
Copy Markdown
Member

When an ESM model is imported for the first time while an app is already running the bokeh DataModel definition, which is usually included in the serialized Document on page load, will not be initialized. This leads to an inscrutable error saying that the Model could not be resolved on the frontend. Here we introduce a flag on the class definition that indicates whether the model is initialized by checking whether we are in a server context when the ReactiveESM class is defined. If so we include the definition on the ReactiveESM model that holds the DataModel instance and by declaring it on a property with a trailing underscore (_defs) we ensure the model definition is unserialized before the instance of that model is deserialized.

@codecov

codecov Bot commented Feb 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.11%. Comparing base (b5981cc) to head (f36dd96).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
panel/custom.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8432      +/-   ##
==========================================
- Coverage   86.11%   86.11%   -0.01%     
==========================================
  Files         349      349              
  Lines       54841    54847       +6     
==========================================
+ Hits        47227    47229       +2     
- Misses       7614     7618       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@philippjfr
philippjfr merged commit 2e2bb36 into main Feb 24, 2026
35 of 40 checks passed
@philippjfr
philippjfr deleted the esm_model_defs branch February 24, 2026 07:58
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant