@@ -227,7 +227,7 @@ function createOptionsStore<
227
227
* @param pinia - The Pinia root instance where the store will be registered.
228
228
* @param hot - When true, build the store in hot-update mode (uses a temporary hotState and enables HMR-specific wiring).
229
229
* @param isOptionsStore - Set to true for stores created from the Options API, so certain setup-store behaviors (like state wiring) are skipped.
230
- * @returns The reactive Store instance is exposing state, getters, actions, and Pinia helpers.
230
+ * @returns A reactive store instance that exposes state, getters, actions, and Pinia helpers.
231
231
*/
232
232
function createSetupStore <
233
233
Id extends string ,
@@ -490,15 +490,15 @@ function createSetupStore<
490
490
{
491
491
_hmrPayload,
492
492
_customProperties : markRaw ( new Set < string > ( ) ) , // devtools custom properties
493
- _options : optionsForPlugin , // store options for plugins
493
+ _options : markRaw ( optionsForPlugin ) , // store options for plugins
494
494
} ,
495
495
partialStore
496
496
// must be added later
497
497
// setupStore
498
498
)
499
499
: assign (
500
500
{
501
- _options : optionsForPlugin , // store options for plugins
501
+ _options : markRaw ( optionsForPlugin ) , // store options for plugins
502
502
} ,
503
503
partialStore
504
504
)
@@ -688,6 +688,16 @@ function createSetupStore<
688
688
}
689
689
} )
690
690
691
+ // sync plugin options
692
+ if ( '_options' in newStore ) {
693
+ Object . defineProperty ( store , '_options' , {
694
+ value : newStore . _options ,
695
+ enumerable : false ,
696
+ configurable : true ,
697
+ writable : false ,
698
+ } )
699
+ }
700
+
691
701
// update the values used in devtools and to allow deleting new properties later on
692
702
store . _hmrPayload = newStore . _hmrPayload
693
703
store . _getters = newStore . _getters
@@ -704,15 +714,21 @@ function createSetupStore<
704
714
}
705
715
706
716
// avoid listing internal properties in devtools
707
- ; ( [ '_p' , '_hmrPayload' , '_getters' , '_customProperties' ] as const ) . forEach (
708
- ( p ) => {
709
- Object . defineProperty (
710
- store ,
711
- p ,
712
- assign ( { value : store [ p ] } , nonEnumerable )
713
- )
714
- }
715
- )
717
+ ; (
718
+ [
719
+ '_p' ,
720
+ '_hmrPayload' ,
721
+ '_getters' ,
722
+ '_customProperties' ,
723
+ '_options' ,
724
+ ] as const
725
+ ) . forEach ( ( p ) => {
726
+ Object . defineProperty (
727
+ store ,
728
+ p ,
729
+ assign ( { value : store [ p ] } , nonEnumerable )
730
+ )
731
+ } )
716
732
}
717
733
718
734
// apply all plugins
0 commit comments