Skip to content

外部からの強制データ上書き・一定期間有効なパッチ上書き #84

Description

@tompng

ar_syncの通知・自動反映を待っていると、ラグが気になることがある
(ボタンを押したらすぐ何か変化があって欲しい、など)
appoloとかでやっているらしい、postしたら(そのレスポンスを元に)データいい感じに更新してくれるやつ

const newtitle = 'あたらしいタイトル' 
await response = post('/post/3', { title: newtitle })
ArSync.foobarUpdateAllData('Post', 3, { title: response.title })
const newtitle = 'あたらしいタイトル' 
const patch = ArSync.foobarAddPatch('Post', 3, { title: newtitle }, { time: 10000 })
try {
  await response = post('/post/3', { title: 'あたらしいタイトル' })
  patch.invalidate()
  ArSync.foobarUpdateAllData('Post', 3, { title: response.title })
} catch(e) {
  patch.invalidate()
}

こんな感じのAPI用意しとけばいいかな?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions