Skip to content

[Bug]: Minify Revit UI state desync after cross-model view switch (reproduced on 5.3.1; same code path in 6.1.0 and latest develop) #3106

@OriAshkenazi

Description

@OriAshkenazi

✅ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a fully equivalent issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

Minify Revit UI can desynchronize from actual ribbon visibility when switching between views in different open models.

Observed behavior:

  • Minify button remains active (orange / on)
  • MINIFYUIACTIVE remains True
  • some configured hidden tabs reappear after cross-model view activation

Reproduced tabs that reappear:

  • Steel
  • Precast
  • Massing & Site

Configured hidden tabs that remained hidden in this repro:

  • Content Catalog
  • In-Place Model
  • In-Place Mass

⌨ Error/Debug Message

No exception dialog appears. This is a state/visibility mismatch.

Captured outputs:

SNAPSHOT A
=== Minify UI Snapshot ===
timestamp: 2026-02-16 14:59:03.038
doc: VDC-SP-603-03_06_XX-DD-M201
path: Autodesk Docs://TLV-Purple Line/VDC-SP-603-03_06_XX-DD-M201.rvt
active view: {3D - oriasR8S2R} [Id=1553829]
env MINIFYUIACTIVE: True
config hidden_tabs parsed: ['Steel', 'Precast', 'Massing & Site', 'Content Catalog', 'In-Place Model', 'In-Place Mass']
-- hidden tab visibility by config name --
Steel -> [True]
Precast -> [True]
Massing & Site -> [True]
Content Catalog -> [False]
In-Place Model -> [False]
In-Place Mass -> [False]
SNAPSHOT B
=== Minify UI Snapshot ===
timestamp: 2026-02-16 14:59:53.828
doc: VDC-SP-603-03_06_XX-DD-M201
active view: {3D - oriasR8S2R} [Id=1553829]
env MINIFYUIACTIVE: True
-- hidden tab visibility by config name --
Steel -> [False]
Precast -> [False]
Massing & Site -> [False]
Content Catalog -> [False]
In-Place Model -> [False]
In-Place Mass -> [False]
SNAPSHOT C
=== Minify UI Snapshot ===
timestamp: 2026-02-16 15:03:19.252
doc: VDC-SP-610-03_06_XX-DD-M201
path: Autodesk Docs://TLV-Purple Line/VDC-SP-610-03_06_XX-DD-M201.rvt
active view: 03_TTR10_B0_Opening Walls -1.22 [Id=1609249]
env MINIFYUIACTIVE: True
-- hidden tab visibility by config name --
Steel -> [True]
Precast -> [True]
Massing & Site -> [True]
Content Catalog -> [False]
In-Place Model -> [False]
In-Place Mass -> [False]
TRACE DUMP
=== Minify Trace Dump ===
trace env MINIFYUI_TRACE_ACTIVE: None
minify env MINIFYUIACTIVE: True
log file: C:\Users\orias\AppData\Roaming\pyRevit\2023\pyRevit_2023_minifyui_trace.log
total log lines: 2
2026-02-16 14:57:48.533 | INIT | Minify Trace handlers attached
2026-02-16 15:00:18.705 | TRACE ON | log=C:\Users\orias\AppData\Roaming\pyRevit\2023\pyRevit_2023_minifyui_trace.log

🎞️ To Reproduce

  1. Open Revit 2023.
  2. Open two project models simultaneously.
  3. Configure Minify hidden tabs:
    • Steel, Precast, Massing & Site, Content Catalog, In-Place Model, In-Place Mass
  4. Enable Minify Revit UI.
  5. Verify tabs are hidden.
  6. Activate a view in the second model.
  7. Return to a view in the first model.
  8. Observe Steel/Precast/Massing & Site are shown again while Minify stays active.

🏲️ Expected behavior

  • With Minify Revit UI active, all configured hidden tabs remain hidden across cross-model/view activations until Minify is explicitly disabled.
  • Minify button icon/state remains synchronized with actual applied ribbon visibility after context switches.

Proposed fix heuristic for maintainer review (pre-implementation):

  1. Use MINIFYUIACTIVE plus configured hidden_tabs as the single source of truth.
  2. Re-apply update_ui(config) when Revit context changes (at least ViewActivated; add document-activation/idling fallback only if needed).
  3. Guard against duplicate event subscriptions in smartbutton lifecycle.
  4. In __selfinit__, initialize icon and applied visibility from current env/config so startup/reload states are consistent.
  5. Keep current behavior unchanged when Minify is off.

Maintainer approval requested: please confirm this heuristic before implementation. No implementation work should start until approval is given.

🖥️ Hardware and Software Setup (please complete the following information)

pyrevit env output from the reproducing machine:

==> Registered Clones (full git repos)
development | Deploy: "basepublic" | Branch: "develop" | Version: "5.3.1.25308+1755" | Path: "C:\Users\orias\pyRevit"
==> Registered Clones (deployed from archive/image)
master | Branch: "master" | Version: "5.3.1.25308+1659" | Path: "C:\Program Files\pyRevit-Master"
==> Attachments
development | Product: "Autodesk Revit 2025" | Engine: DEFAULT (2712) | Path: "C:\Users\orias\pyRevit"
master | Product: "Autodesk Revit 2024" | Engine: DEFAULT (2712) | Path: "C:\Program Files\pyRevit-Master"
master | Product: "Autodesk Revit 2023" | Engine: DEFAULT (2712) | Path: "C:\Program Files\pyRevit-Master" | AllUsers
master | Product: "Autodesk Revit 2021" | Engine: DEFAULT (2712) | Path: "C:\Program Files\pyRevit-Master" | AllUsers
master | Product: "2019.2.6" | Engine: DEFAULT (2712) | Path: "C:\Program Files\pyRevit-Master" | AllUsers
==> Installed Extensions
CostEstimates | Type: UIExtension | Repo: "git@github.com:OriAshkenazi/Test.extension.git" | Installed: "C:\Users\orias\AppData\Roaming\CustomRevitExtentions\Test.extension"
pbs-handler | Type: Unknown | Repo: "" | Installed: "C:\Users\orias\AppData\Roaming\pyRevit\Extensions\pbs-handler.extension"
==> Installed Revits
Autodesk Revit 2023 | Version: 23.1.80.30 | Build: 20250724_1515(x64)

Additional context

  • Runtime reproduction above was performed on pyRevit 5.3.1 attached to Revit 2023.
  • Re-check against latest source:
  • Pulled origin/develop to commit 6f1ea3fa.
  • Fetched v6.1.0.26047+2255.
  • Verified Minify bug-path files are byte-identical across:
  • v6.0.0.26032+2145
  • v6.1.0.26047+2255
  • origin/develop (and local develop after pull)
  • Relevant unchanged files:
    • extensions/pyRevitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/minifyui.py
    • extensions/pyRevitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/script.py
    • extensions/pyRevitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/config.py
  • Current Minify logic still applies tab visibility only in update_ui() and only when toggle/config runs, with no activation event hook in Minify __selfinit__.
  • Possible overlap with #1716.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions