memi-board 0.43.0 → 0.44.1

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/README.md CHANGED
@@ -196,10 +196,26 @@ const { post: postSeo } = await useMemiBoardPostSeo({
196
196
  `/board/${encodeURIComponent(categoryId.value)}/${encodeURIComponent(id.value)}`,
197
197
  ),
198
198
  })
199
- // postSeo: id · title · previewImage 등 — 상세 로드와 공유 가능
199
+ // postSeo: id · title · previewImage 등 — SSR 첫 로드에서는 바로 채워진다.
200
+ // 클라이언트 이동에서는 화면 전환을 막지 않으려고 기다리지 않으므로 처음엔 null 일 수 있다.
201
+
202
+ const { resolvePostIdBySlug } = useMemiBoardPosts(categoryId)
203
+ const internalId = ref('')
204
+ watch([categoryId, id], async ([category, slug]) => {
205
+ if (postSeo.value?.id && postSeo.value.category === category && postSeo.value.slug === slug) {
206
+ internalId.value = postSeo.value.id
207
+ return
208
+ }
209
+ if (import.meta.server) return
210
+ // id 만 조회 (본문은 MemiBoardDetail 이 구독). 방금 작성한 글은 조회 없이 바로 나온다.
211
+ const result = await resolvePostIdBySlug(slug)
212
+ internalId.value = result.status === 'ok' ? result.id : ''
213
+ }, { immediate: true })
200
214
  </script>
201
215
  ```
202
216
 
217
+ > 상세·수정 페이지에서 slug → id 는 `getPostBySlug`(본문까지 읽음) 대신 `resolvePostIdBySlug` 를 쓴다. 저장 직후 미리보기 진입이 Firestore 왕복 2회만큼 빨라진다.
218
+
203
219
  | composable | 대상 | OG 요약 |
204
220
  |------------|------|---------|
205
221
  | `useMemiBoardListSeo` | 목록 | 카테고리 label·description, 최근 공개 글 이미지 |
@@ -11,6 +11,8 @@ export interface CreatePostInput {
11
11
  authorName: string | null;
12
12
  authorPhoto: string | null;
13
13
  moderationModel?: string;
14
+ /** resolveUniqueSlug 로 미리 구한 slug. 없으면 createPost 가 직접 구한다. */
15
+ slug?: string;
14
16
  }
15
17
  export interface UpdatePostInput {
16
18
  title: string;
@@ -29,6 +31,17 @@ export type GetPostBySlugResult = {
29
31
  status: 'error';
30
32
  message: string;
31
33
  };
34
+ export type ResolvePostIdResult = {
35
+ status: 'ok';
36
+ id: string;
37
+ } | {
38
+ status: 'not-found';
39
+ } | {
40
+ status: 'permission-denied';
41
+ } | {
42
+ status: 'error';
43
+ message: string;
44
+ };
32
45
  export declare function isFirestorePermissionDenied(error: unknown): boolean;
33
46
  /** 목록은 posts 메타만, 본문(body/main)은 상세에서만. */
34
47
  export declare function useMemiBoardPosts(boardId: MaybeRefOrGetter<string>): {
@@ -44,6 +57,8 @@ export declare function useMemiBoardPosts(boardId: MaybeRefOrGetter<string>): {
44
57
  }>;
45
58
  getPost: (id: string) => Promise<PostDetail | null>;
46
59
  getPostBySlug: (slug: string) => Promise<GetPostBySlugResult>;
60
+ resolvePostIdBySlug: (slug: string) => Promise<ResolvePostIdResult>;
61
+ resolveUniqueSlug: (title: string) => Promise<string>;
47
62
  getAdjacentPosts: (current: PostModel) => Promise<{
48
63
  previous: PostModel | null;
49
64
  next: PostModel | null;
package/dist/index.d.ts CHANGED
@@ -8,8 +8,9 @@ export type { PublicSeoDb } from './composables/fetchPublicSeo';
8
8
  export { boardPostOgTitle, boardPostOgDescription, boardListOgTitle, boardListOgDescription, toAbsoluteUrl, asHttpUrl, toBoardOgImageUrl, normalizeBasePath, } from './utils/boardSeo';
9
9
  export type { BoardPostSeoPayload, BoardListSeoPayload } from './utils/boardSeo';
10
10
  export { useMemiBoardAuth } from './composables/useMemiBoardAuth';
11
+ export { imeSafeSubmitClick, imeSafeSubmitPointerDown } from './utils/imeSafeSubmit';
11
12
  export { useMemiBoardPosts, useMemiBoardPostList, useMemiBoardPost } from './composables/useMemiBoardPosts';
12
- export type { CreatePostInput, UpdatePostInput, GetPostBySlugResult } from './composables/useMemiBoardPosts';
13
+ export type { CreatePostInput, UpdatePostInput, GetPostBySlugResult, ResolvePostIdResult } from './composables/useMemiBoardPosts';
13
14
  export { isFirestorePermissionDenied } from './composables/useMemiBoardPosts';
14
15
  export { useMemiBoardUserPosts } from './composables/useMemiBoardUserPosts';
15
16
  export { useMemiBoardUserComments } from './composables/useMemiBoardUserComments';