Pular para o conteúdo
Kitbay
Skill

enforce-rules-for-pinia-synced

MITAtualizado em 13 de nov. de 202651.383Estrelas no GitHub

A contributor skill in the AIRI repository covering Vue state stores built with Pinia whose state is shared between Electron windows by the pinia-plugin-synced package.

O que a skill ensina

A contributor skill in the AIRI repository covering Vue state stores built with Pinia whose state is shared between Electron windows by the pinia-plugin-synced package. It explains that the plugin copies snapshots and routes actions through a leader window rather than sharing Vue refs, so only stores that truly need cross-window ownership should sync, and only small, cloneable source-of-truth state. Watchers must not write synced state directly; they may call an idempotent, awaited synced action instead. Side-effecting actions belong to the leader and must be async, persistence needs one explicit owner, every renderer must set its leadership mode, and a multi-window test should show that remote snapshots do not trigger local writes.

O que faz

  • Decide which Pinia state to sync
  • Avoid watcher writes to synced state
  • Assign leader-owned actions and persistence
  • Test multi-window state sync