File tree 1 file changed +6
-3
lines changed
packages/pinia/src/devtools
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ export async function actionGlobalCopyState(pinia: Pinia) {
47
47
export async function actionGlobalPasteState ( pinia : Pinia ) {
48
48
if ( checkClipboardAccess ( ) ) return
49
49
try {
50
- pinia . state . value = JSON . parse ( await navigator . clipboard . readText ( ) )
50
+ Object . assign (
51
+ pinia . state . value ,
52
+ JSON . parse ( await navigator . clipboard . readText ( ) )
53
+ )
51
54
toastMessage ( 'Global state pasted from clipboard.' )
52
55
} catch ( error ) {
53
56
if ( checkNotFocusedError ( error ) ) return
@@ -104,11 +107,11 @@ function getFileOpener() {
104
107
105
108
export async function actionGlobalOpenStateFile ( pinia : Pinia ) {
106
109
try {
107
- const open = await getFileOpener ( )
110
+ const open = getFileOpener ( )
108
111
const result = await open ( )
109
112
if ( ! result ) return
110
113
const { text, file } = result
111
- pinia . state . value = JSON . parse ( text )
114
+ Object . assign ( pinia . state . value , JSON . parse ( text ) )
112
115
toastMessage ( `Global state imported from "${ file . name } ".` )
113
116
} catch ( error ) {
114
117
toastMessage (
You can’t perform that action at this time.
0 commit comments