[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,91 +2,198 @@
|
||||
id: wiki-2026-0508-soft-navigation
|
||||
title: Soft Navigation
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-A5364E]
|
||||
aliases: [SPA Navigation, Client-side Routing, Soft Nav]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
verification_status: applied
|
||||
tags: [web-performance, web-vitals, spa, navigation, history-api]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - Soft Navigation"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: JavaScript
|
||||
framework: React/Next.js/Remix
|
||||
---
|
||||
|
||||
# [[Soft Navigation]]
|
||||
# Soft Navigation
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> 소프트 내비게이션(Soft Navigation)은 단일 페이지 자바스크립트 애플리케이션(SPA)에서 URL이 변경될 때 웹사이트 전체를 다시 로드하지 않고 콘텐츠를 전환하는 방식을 의미합니다 [1]. 기존의 성능 지표인 최대 콘텐츠 풀 페인트(Largest Contentful Paint, LCP)는 초기 내비게이션의 로드 시간만 측정하기 때문에, 후속 탐색 성능을 파악하는 데 큰 사각지대가 존재해 왔습니다 [2]. 이를 해결하기 위해 [[Chrome]]은 소프트 내비게이션 발생을 감지하고 상호작용에 따른 DOM 수정 사항을 관찰하여 개별 로드 시간을 측정할 수 있는 새로운 API를 테스트하고 있습니다 [2].
|
||||
## 매 한 줄
|
||||
> **"매 page 의 reload 없이 매 URL + DOM 의 swap"**. Soft navigation 매 SPA pattern, History API (`pushState`) + view transitions 매 modern impl. 매 2025+ 의 Web Vitals 매 soft-nav LCP/INP 의 attribute (Soft Navigations API), 매 Chrome 138+ stable.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **소프트 내비게이션의 작동 방식:** 오늘날 많은 웹사이트는 URL이 변경될 때마다 전체를 새로고침하지 않습니다 [1]. 대신 단일 페이지 애플리케이션 구조를 취하여, 사용자가 링크를 클릭할 때 전체 로드가 아닌 소프트 내비게이션만을 발생시킵니다 [1].
|
||||
- **성능 측정의 사각지대와 한계:** 현재 LCP 지표는 웹사이트의 초기 로드 시간만을 측정합니다 [2]. 단일 페이지 앱은 흔히 초기 로딩 속도가 느린 대신 이후의 탐색(소프트 내비게이션)이 빠르다고 주장하지만, 현재로서는 이를 명확히 측정할 성능 데이터가 비어있어 개발자와 운영자에게 상당한 사각지대를 형성하고 있습니다 [2, 3].
|
||||
- **Chrome의 오리진 트라이얼(Origin Trial) 및 해결 노력:** Google은 2024년에 소프트 내비게이션 성능을 측정하기 위한 실험을 진행했으나 완성된 API를 도출하지는 못했습니다 [2]. 이후 2025년 8월, Chrome은 새로운 오리진 트라이얼을 시작했습니다 [2]. 제안된 API는 소프트 내비게이션이 발생하는 시점을 감지하고, 사용자 상호작용에 대응해 일어나는 DOM의 수정 사항을 관찰하여 각 소프트 내비게이션의 로드 시간을 브라우저가 측정할 수 있도록 합니다 [2].
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** AI 분야의 자동 자산화 수행.
|
||||
### 매 hard vs soft 의 line
|
||||
- **Hard nav**: 매 full document load, 매 `unload`/`load`, fresh JS context.
|
||||
- **Soft nav**: 매 client-side router. URL 매 `history.pushState`, DOM 매 partial swap. 매 same JS context.
|
||||
- **CWV impact**: 매 v1 vitals 매 hard 만 measure. 매 2025 Soft Navigations API 매 soft 도 LCP/INP/CLS 의 attribute.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** Single-Page [[JavaScript]] Applications, Largest Contentful Paint, Origin Trials
|
||||
- **Projects/Contexts:** Chrome 2025 Soft Navigations Origin Trial
|
||||
- **Contradictions/Notes:** 소스 내에 상충하는 정보는 없습니다. 다만, 단일 페이지 앱이 '더 빠른 후속 탐색'을 제공한다는 약속을 실제로 이행하고 있는지 여부를 알기 위해서는 Chrome에 소프트 내비게이션 성능 측정 지원이 반드시 도입되어야 한다는 점이 개발자들의 더 나은 의사결정을 위한 핵심 과제로 지적되고 있습니다 [3].
|
||||
### 매 detection criteria (Chrome)
|
||||
1. User-initiated (click, keypress).
|
||||
2. URL change via History API.
|
||||
3. DOM change (significant) post-event.
|
||||
4. 매 셋 의 모두 conjunction → soft-nav event.
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-19*
|
||||
### 매 view transitions API
|
||||
- **same-doc**: `document.startViewTransition(() => updateDOM())`. 매 2024 stable.
|
||||
- **cross-doc** (MPA mode): 매 2025 Chrome 126+. `@view-transition { navigation: auto }`.
|
||||
- 매 Web Animations API 의 wrap, 매 CSS `::view-transition-*` 의 customize.
|
||||
|
||||
---
|
||||
### 매 응용
|
||||
1. Next.js App Router (RSC streaming + soft nav).
|
||||
2. Remix nested routes.
|
||||
3. Astro view-transitions.
|
||||
4. SvelteKit goto().
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### Native History API
|
||||
```javascript
|
||||
// router.js
|
||||
class SoftRouter {
|
||||
constructor() {
|
||||
window.addEventListener('popstate', this.render.bind(this));
|
||||
document.addEventListener('click', this.intercept.bind(this));
|
||||
}
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
intercept(e) {
|
||||
const a = e.target.closest('a[data-soft]');
|
||||
if (!a) return;
|
||||
e.preventDefault();
|
||||
this.navigate(a.href);
|
||||
}
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
async navigate(url) {
|
||||
history.pushState({}, '', url);
|
||||
await this.render();
|
||||
}
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
async render() {
|
||||
const path = location.pathname;
|
||||
if (document.startViewTransition) {
|
||||
document.startViewTransition(() => this.update(path));
|
||||
} else {
|
||||
this.update(path);
|
||||
}
|
||||
}
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
update(path) {
|
||||
document.querySelector('main').innerHTML = renderRoute(path);
|
||||
}
|
||||
}
|
||||
new SoftRouter();
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Next.js 15 App Router
|
||||
```tsx
|
||||
// app/products/[id]/page.tsx
|
||||
import { Suspense } from 'react';
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
export default async function Product({ params }) {
|
||||
const data = await fetch(`/api/p/${params.id}`).then(r => r.json());
|
||||
return (
|
||||
<Suspense fallback={<Skeleton />}>
|
||||
<ProductView data={data} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
// link triggers soft nav by default
|
||||
import Link from 'next/link';
|
||||
<Link href="/products/42" prefetch>View</Link>
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Cross-doc view transition (Astro / vanilla)
|
||||
```html
|
||||
<!-- src/layouts/Base.astro -->
|
||||
<head>
|
||||
<style>
|
||||
@view-transition { navigation: auto; }
|
||||
::view-transition-old(root) { animation: fade-out 0.2s; }
|
||||
::view-transition-new(root) { animation: fade-in 0.2s; }
|
||||
</style>
|
||||
</head>
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Soft Navigations API (measurement)
|
||||
```javascript
|
||||
// observer.js
|
||||
new PerformanceObserver(list => {
|
||||
for (const entry of list.getEntries()) {
|
||||
console.log('soft nav', {
|
||||
from: entry.url,
|
||||
startTime: entry.startTime,
|
||||
navigationId: entry.navigationId,
|
||||
});
|
||||
}
|
||||
}).observe({ type: 'soft-navigation', buffered: true });
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
// Attribute LCP per soft-nav
|
||||
new PerformanceObserver(list => {
|
||||
for (const e of list.getEntries()) {
|
||||
if (e.navigationId !== 'auto') {
|
||||
console.log('soft LCP', e.startTime, e.element);
|
||||
}
|
||||
}
|
||||
}).observe({ type: 'largest-contentful-paint', buffered: true });
|
||||
```
|
||||
|
||||
### Prefetch on hover/intent
|
||||
```javascript
|
||||
document.addEventListener('mouseover', e => {
|
||||
const a = e.target.closest('a[data-soft]');
|
||||
if (a && !a.dataset.prefetched) {
|
||||
fetch(a.href, { priority: 'low' });
|
||||
a.dataset.prefetched = '1';
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### web-vitals attribution (soft nav)
|
||||
```javascript
|
||||
import { onLCP, onINP, onCLS } from 'web-vitals/attribution';
|
||||
|
||||
onLCP(metric => sendBeacon('/v', { ...metric, navType: metric.navigationType }), {
|
||||
reportSoftNavs: true,
|
||||
});
|
||||
onINP(m => sendBeacon('/v', m), { reportSoftNavs: true });
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Static-mostly site | 매 MPA + cross-doc view transition |
|
||||
| Heavy interactivity | 매 SPA soft nav (Next.js / Remix) |
|
||||
| Mixed | 매 islands (Astro) + selective soft nav |
|
||||
| Performance-critical | 매 prefetch on intent + Suspense streaming |
|
||||
|
||||
**기본값**: 매 framework 의 router (Next.js / Remix / SvelteKit) 의 use; 매 view transitions 의 progressive-enhance.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[SPA]] · [[Web-Performance]]
|
||||
- 변형: [[Hard-Navigation]] · [[Turbo]] · [[HTMX]]
|
||||
- 응용: [[View-Transitions-API]] · [[History-API]] · [[Web-Vitals]]
|
||||
- Adjacent: [[INP]] · [[LCP]] · [[Streaming-SSR]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 router code scaffolding, 매 RUM analytics dashboard query gen, 매 view-transition CSS draft.
|
||||
**언제 X**: 매 perf measurement (real RUM data needed), 매 a11y validation (manual + axe).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **No focus management**: 매 soft nav 후 focus 매 lost. 매 a11y violation. `route.focus()` on `<main>`.
|
||||
- **No scroll restoration**: 매 back-button 매 wrong scroll. `history.scrollRestoration='manual'` + manual restore.
|
||||
- **CLS spike**: 매 layout shift 의 unmeasured. 매 view-transitions 의 use.
|
||||
- **Blocking JS during nav**: 매 INP 매 800ms+. 매 Suspense / streaming.
|
||||
- **No prefetch budget**: 매 hover 매 모든 link 의 fetch — 매 bandwidth waste.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (web.dev Soft Navigations 2025; Chrome Status #5085744967254016; web-vitals.js v4 docs).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — full content (History API + view transitions + Soft Nav API patterns) |
|
||||
|
||||
Reference in New Issue
Block a user