@dooboostore/simple-web-component 1.0.51 → 1.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/elements/SwcAppMixin.js +7 -1
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +7 -1
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +8 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +8 -2
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
- package/package.json +2 -2
- package/src/elements/SwcAppMixin.ts +11 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dooboostore/simple-web-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@dooboostore/core": "1.0.33",
|
|
99
99
|
"@dooboostore/core-web": "1.0.14",
|
|
100
|
-
"@dooboostore/simple-boot": "1.0.
|
|
100
|
+
"@dooboostore/simple-boot": "1.0.59"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"clean": "rm -rf dist",
|
|
@@ -56,6 +56,8 @@ export const setSSRAttribute = (i: HTMLElement) => {
|
|
|
56
56
|
i.setAttribute('swc-use-ssr', (i as any)._swcId ?? '');
|
|
57
57
|
};
|
|
58
58
|
export const removeSSRAttribute = (i: HTMLElement) => {
|
|
59
|
+
// 표식은 지워도 "서버가 그린 엘리먼트"였다는 건 기억한다 → 첫 라우트(같은 경로)를 다시 그리지 않게 (_invokeRouteChangeSubscribers)
|
|
60
|
+
if (isSSR(i)) (i as any).__swc_ssrRoute ??= true;
|
|
59
61
|
i.removeAttribute('swc-use-ssr');
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -142,6 +144,14 @@ export function SwcAppMixin<T extends { new (...args: any[]): HTMLElement }>(Bas
|
|
|
142
144
|
// live는 전부 실행, replay는 해당 trigger 구독자만 실행.
|
|
143
145
|
// on(enter/update/leave) 판정을 위해 구독자별 직전 매칭 상태를 기억한다 (멈춘 뒤에도 상태는 계속 갱신).
|
|
144
146
|
const state = routeStateOf(instance);
|
|
147
|
+
// 서버가 이미 이 경로로 그려 보낸 엘리먼트는 같은 경로에 대해 다시 그리지 않는다 (@onConnected 렌더를 건너뛰는 것과 같은 규칙).
|
|
148
|
+
// 연결 때(connected)와 라우터 시작 때(live) 두 번 오므로 경로를 기억해 둘 다 건너뛰고, 다른 경로로 가면 잊는다.
|
|
149
|
+
// 매칭 상태는 아래에서 그대로 기록해 이후 enter/update/leave 판정은 정상으로 돈다.
|
|
150
|
+
const routeSig = JSON.stringify([re.path ?? '', re.search ?? '']);
|
|
151
|
+
if (ValidUtils.isBrowser() && isSSR(instance)) (instance as any).__swc_ssrRoute ??= true;
|
|
152
|
+
if ((instance as any).__swc_ssrRoute === true) (instance as any).__swc_ssrRoute = routeSig;
|
|
153
|
+
const ssrPainted = (instance as any).__swc_ssrRoute === routeSig;
|
|
154
|
+
if (!ssrPainted) delete (instance as any).__swc_ssrRoute;
|
|
145
155
|
let stopped = false;
|
|
146
156
|
for (const metadata of routeChangeSubscribers) {
|
|
147
157
|
if (phase !== 'live' && (metadata.options?.trigger ?? 'connected') !== phase) continue;
|
|
@@ -168,7 +178,7 @@ export function SwcAppMixin<T extends { new (...args: any[]): HTMLElement }>(Bas
|
|
|
168
178
|
: on === 'update' ? !!match && !!prev?.matched && prev.signature !== signature
|
|
169
179
|
: on === 'leave' ? !match && !!prev?.matched
|
|
170
180
|
: false;
|
|
171
|
-
if (stopped || !shouldRun || !instance[methodName]) continue;
|
|
181
|
+
if (stopped || ssrPainted || !shouldRun || !instance[methodName]) continue;
|
|
172
182
|
|
|
173
183
|
// leave 는 지금 경로가 안 맞으므로 직전 매칭의 pathData 로 준다
|
|
174
184
|
const pathData = match ? match.pathData : prev?.pathData ?? {};
|