Skip to content

Commit 3fba579

Browse files
committed
Merge branch 'post-milestone3m' of https://github.com/solidos/solid-panes into post-milestone3m
2 parents 5fb63ae + cb8961f commit 3fba579

4 files changed

Lines changed: 31 additions & 4 deletions

File tree

src/icons/signUp.svg

Lines changed: 9 additions & 0 deletions
Loading

src/icons/signup.png

-337 Bytes
Binary file not shown.

src/mainPage/header.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import loginIconSvg from '../icons/person.svg?raw'
1010
import signOutIconSvg from '../icons/signOut.svg?raw'
1111
import defaultAvatarIconSvg from '../icons/personInCircle.svg?raw'
1212
import downArrowIconSvg from '../icons/downArrow.svg?raw'
13-
import signupIconPng from '../icons/signup.png'
13+
import signupIconSvg from '../icons/signUp.svg?raw'
1414
import { createUiIcon } from '../icons/iconHelper'
1515
import { setActiveMenuPane } from './menu'
1616
/**
1717
* menu icons
1818
*/
1919
const HELP_MENU_ICON = createUiIcon(helpIconSvg, 'Help Icon', '#ffffff')
2020
const LOGIN_ICON = createUiIcon(loginIconSvg, 'LogIn Icon', '#ffffff')
21-
const SIGNUP_ICON = signupIconPng
21+
const SIGNUP_ICON = createUiIcon(signupIconSvg, 'SignUp Icon', '#ffffff')
2222
const LOGOUT_ICON = createUiIcon(signOutIconSvg, 'LogOut Icon', '#000000')
2323
const DEFAULT_AVATAR_ICON = createUiIcon(defaultAvatarIconSvg, 'Default Avatar Icon', '#6A7282')
2424
const DOWN_ARROW_ICON = createUiIcon(downArrowIconSvg, 'Down Arrow Icon', '#ffffff')

src/mainPage/index.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,21 @@
44
*/
55

66
import { LiveStore, NamedNode } from 'rdflib'
7+
import type { RenderEnvironment } from 'pane-registry'
78
import { getOutliner, OutlineManager } from '../index'
89
import { createHeader, refreshHeader } from './header'
910
import { createFooter } from './footer'
1011
import { createLeftSideMenu, refreshMenu } from './menu'
1112

13+
// Symbol used to stash the last render-relevant env snapshot on the outliner
14+
// so refreshUI can skip a full GotoSubject re-render when nothing changed.
15+
const LAST_RENDER_ENV_KEY = '__lastRenderEnvSignature'
16+
17+
function renderEnvSignature (env?: RenderEnvironment): string {
18+
if (!env) return ''
19+
return [env.layout, env.theme, env.inputMode].join('|')
20+
}
21+
1222
export { refreshMenu as updateMenuLayout } from './menu'
1323
export { refreshHeader } from './header'
1424

@@ -28,10 +38,11 @@ function ensureMainContent () {
2838
export async function initMainPage (
2939
store: LiveStore,
3040
uri?: string | NamedNode | null,
31-
environment?: any
41+
environment?: RenderEnvironment
3242
) {
3343
ensureMainContent()
3444
const outliner = getOutliner(document, environment)
45+
;(outliner as any)[LAST_RENDER_ENV_KEY] = renderEnvSignature(environment)
3546
uri = uri || window.location.href
3647
const subject: NamedNode = typeof uri === 'string' ? store.sym(uri) : uri
3748
outliner.GotoSubject(subject, true, undefined, true, undefined)
@@ -49,8 +60,15 @@ export async function refreshUI (outliner: OutlineManager) {
4960
const paneName = window.history.state?.paneName
5061
const pane = paneName ? paneRegistry?.byName?.(paneName) : undefined
5162

52-
if (store && typeof outliner?.GotoSubject === 'function') {
63+
// Only re-run GotoSubject (full pane re-render) when render-relevant
64+
// environment fields actually changed since the last render.
65+
const currentSignature = renderEnvSignature(outliner?.context?.environment)
66+
const previousSignature = (outliner as any)?.[LAST_RENDER_ENV_KEY] ?? ''
67+
const envChanged = currentSignature !== previousSignature
68+
69+
if (envChanged && store && typeof outliner?.GotoSubject === 'function') {
5370
outliner.GotoSubject(store.sym(subjectUri), true, pane, true, undefined)
71+
;(outliner as any)[LAST_RENDER_ENV_KEY] = currentSignature
5472
}
5573

5674
await refreshHeader(outliner)

0 commit comments

Comments
 (0)