Skip to content

Commit 637a2f1

Browse files
committed
fix: code page container flickering
1 parent 72c4f03 commit 637a2f1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/composables/useSettings.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ const STORAGE_KEY = 'npmx-settings'
8181
// Shared settings instance (singleton per app)
8282
let settingsRef: RemovableRef<AppSettings> | null = null
8383

84+
const hasHydrated = ref(false)
85+
8486
/**
8587
* Composable for managing application settings with localStorage persistence.
8688
* Settings are shared across all components that use this composable.
@@ -241,9 +243,12 @@ export function useBackgroundTheme() {
241243

242244
export function useCodeContainer() {
243245
const { settings } = useSettings()
244-
const isMounted = useMounted()
245246

246-
const codeContainerFull = computed(() => isMounted.value && settings.value.codeContainerFull)
247+
onMounted(() => {
248+
hasHydrated.value = true
249+
})
250+
251+
const codeContainerFull = computed(() => hasHydrated.value && settings.value.codeContainerFull)
247252

248253
function toggleCodeContainer() {
249254
settings.value.codeContainerFull = !settings.value.codeContainerFull

app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ onPrehydrate(() => {
293293
const container = document.getElementById('code-page-container')
294294
295295
if (settingsSaved?.codeContainerFull === true && container) {
296+
console.log('add max-w-full');
296297
container!.classList.add('max-w-full', 'border-0')
297298
}
298299
})
@@ -335,8 +336,8 @@ onPrehydrate(() => {
335336
<div
336337
v-else-if="!!fileTree"
337338
id="code-page-container"
338-
class="container w-full grid grid-cols-[18rem_1fr] max-lg:grid-cols-[16rem_1fr] max-md:grid-cols-[1fr] border-border border-is border-ie transition-mix-width duration-200 ease-in-out px-0"
339-
:class="{ 'max-w-full border-0': codeContainerFull }"
339+
class="w-full grid grid-cols-[18rem_1fr] max-lg:grid-cols-[16rem_1fr] max-md:grid-cols-[1fr] border-border border-x px-0 mx-auto transition-[max-width] duration-300"
340+
:class="[codeContainerFull ? 'max-w-full border-0' : 'container']"
340341
dir="ltr"
341342
>
342343
<!-- File tree sidebar - sticky with internal scroll -->

0 commit comments

Comments
 (0)