MCPcopy Index your code
hub / github.com/python/cpython / restoreUIState

Function restoreUIState

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js:174–201  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172
173// Restore theme from localStorage, or use browser preference
174function restoreUIState() {
175 applyTheme(getPreferredTheme());
176
177 // Restore sidebar state
178 const savedSidebar = localStorage.getItem('flamegraph-sidebar');
179 if (savedSidebar === 'collapsed') {
180 const sidebar = document.getElementById('sidebar');
181 if (sidebar) sidebar.classList.add('collapsed');
182 }
183
184 // Restore sidebar width
185 const savedWidth = localStorage.getItem('flamegraph-sidebar-width');
186 if (savedWidth) {
187 const sidebar = document.getElementById('sidebar');
188 if (sidebar) {
189 sidebar.style.width = savedWidth + 'px';
190 }
191 }
192
193 // Restore collapsed sections
194 const collapsedSections = JSON.parse(localStorage.getItem('flamegraph-collapsed-sections') || '{}');
195 for (const [sectionId, isCollapsed] of Object.entries(collapsedSections)) {
196 if (isCollapsed) {
197 const section = document.getElementById(sectionId);
198 if (section) section.classList.add('collapsed');
199 }
200 }
201}
202
203// ============================================================================
204// Logo/Favicon Setup

Callers 1

initFlamegraphFunction · 0.70

Calls 5

applyThemeFunction · 0.85
getPreferredThemeFunction · 0.85
getElementByIdMethod · 0.80
addMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…