Skip to content

Commit 873d276

Browse files
committed
small fix
1 parent 0146d06 commit 873d276

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

client/src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ export class Api {
447447
return this.fetchWithCache<Server>(this.defaultHost, endpoint, uri, {})
448448
}
449449

450-
async getEntity(ccid: string, hint?: string): Promise<Document<Entity>> {
450+
async getEntity(ccid: string, hint?: string, opts?: FetchOptions<SignedDocument>): Promise<Document<Entity>> {
451451
if (ccid.startsWith('cckv://')) {
452452
ccid = ccid.replace('cckv://', '').split('/')[0]
453453
}
@@ -461,7 +461,7 @@ export class Api {
461461
owner: ccid
462462
})
463463

464-
const sd = await this.fetchWithCache<SignedDocument>(this.defaultHost, endpoint, uri, {})
464+
const sd = await this.fetchWithCache<SignedDocument>(this.defaultHost, endpoint, uri, { ...opts })
465465

466466
const document: Document<Entity> = JSON.parse(sd.document)
467467
if (!document.kind) document.kind = 'entity'

worldlib/src/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ export class Client {
316316
const server = await api.getServer(host)
317317
const ccid = authProvider.getCCID()
318318

319-
const entity = await api.getEntity(ccid)
319+
// オンライン時はキャッシュを介さず登録の実在をサーバーに確認する。サーバーリセットや移行で
320+
// 登録が消えている場合、キャッシュから起動してしまうと後段のsubkeyチェックだけが失敗して
321+
// 「subkey無効」と誤検知するため、ここでNotFoundErrorを投げて「登録なし」としてアプリ側に伝える
322+
const entity = await api.getEntity(ccid, undefined, online ? { cache: 'no-cache' } : undefined)
320323

321324
// 各種タイムラインの作成やリストの読み込みなどの初期化はアプリケーション側の責務
322325
const client = new Client(api, ccid, entity.value, server, profile)

0 commit comments

Comments
 (0)