Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Resolving design modifiers based on the theme type #4978

Merged
merged 4 commits into from
May 6, 2024

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented May 30, 2023

Found this while trying out objgraph on a dummy app (to find a memory leak on a bigger app) and it proved useful as it detected that opening a new session of the same app generated some new NativeDefaultTheme objects that weren't cleaned up. This happened because _resolve_modifiers - which is decorated with @functools.lru_cache - was passed a new instance of the theme instead of its type, while I believe passing the type is enough (I haven't followed all the modifiers related code though).

@maximlt
Copy link
Member Author

maximlt commented May 30, 2023

Well I should have ran the tests locally first! It seems like this change broke a few things. Marking the PR as draft.

@maximlt maximlt marked this pull request as draft May 30, 2023 14:49
@philippjfr
Copy link
Member

Suspect sometimes the theme is passed in as the type and sometimes as the instance, so it just needs an isinstance check.

panel/theme/base.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (eac968a) 22.35% compared to head (7645f26) 84.44%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4978       +/-   ##
===========================================
+ Coverage   22.35%   84.44%   +62.09%     
===========================================
  Files         299      299               
  Lines       44647    44680       +33     
===========================================
+ Hits         9980    37730    +27750     
+ Misses      34667     6950    -27717     
Flag Coverage Δ
ui-tests 40.68% <100.00%> (?)
unitexamples-tests 72.23% <100.00%> (+49.88%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@philippjfr philippjfr marked this pull request as ready for review May 31, 2023 09:44
Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

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

Looks good to me and thanks for catching this!

Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

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

Looks good to me and thanks for catching this!

@philippjfr philippjfr merged commit e6f658f into main May 6, 2024
15 checks passed
@philippjfr philippjfr deleted the fix_cache_modifiers branch May 6, 2024 17:27
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.

2 participants