Skip to content

Differences from standard Pinia ​

unix-pinia replicates the Pinia API surface 1:1; because UTS compiles to Kotlin/Swift without Proxy, objects cannot gain dynamic properties and fields cannot be enumerated at runtime, some capabilities cannot be implemented. Each is listed with its reason and replacement.

Form differences (implemented, different form) ​

Standard Piniaunix-piniaReason
store.$patch(fn)patch(store, fn) top-level functionmethods cannot be attached to store objects
store.$idgetStoreId(store)same
store.$dispose()dispose(store)same
Script state access store.countstore.count.valueUTS has no Proxy; templates auto-unwrap after storeToRefs destructuring
defineStore type inferenceexplicit type annotation requiredUTS inference is limited; explicit is safer
pinia.use plugins may return objects merged into the storeplugins return void, hook logic onlyUTS forbids injecting properties into existing objects

Pruned APIs (not implementable) ​

APIReasonReplacement
Options-style defineStoreUTS this is limited to class methodssetup style (Pinia officially recommends it too)
$patch(对象) object formno Partial<T>, no field reflectionpatch(store, mutator)
$subscribe(cb)deep watch does not fire on RefImpl fields in Android (verified, cross-platform mismatch)per-field watch(store.count, cb)
$onAction(cb)action enumeration is not implementableexplicit logging inside actions
$state snapshotfield enumeration is not implementableper-field operations inside a patch mutator
mapState helperscomposition API is the mainstream; spread injection unverifiedstoreToRefs destructuring
devtools / HMR / SSRno such mechanisms on native—
acceptHMRUpdatesame—

Behavioral parity (not pruned) ​

ItemNote
$reset not built instandard Pinia's setup stores behave the same (throws); provide a custom reset action
Required idPinia's id inference relies on Symbol/SSR context
Multiple Pinia instancesone global store registry (no multi-instance isolation scenario in uni-app x apps); createPinia instances carry plugins and the active flag

Mounting difference ​

app.use(pinia) does not fire install on vdom-mode native (verified) — unix-pinia adopts mount-free as the only reliable form: zero setup code; for plugins use top-level setActivePinia(createPinia().use(plugin)).

Released under the MIT License.