File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
plugins/speculation-rules Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ const { actions } = store( 'speculationRules', {
51
51
if ( ! formData . get ( 's' ) ) {
52
52
context . speculativeLoadUrl = null ;
53
53
} else {
54
- const url = new URL ( form . action || location . href ) ;
54
+ const url = new URL ( form . action ) ;
55
55
url . search = new URLSearchParams ( formData ) . toString ( ) ;
56
56
context . speculativeLoadUrl = url . href ;
57
57
}
@@ -63,11 +63,12 @@ const { actions } = store( 'speculationRules', {
63
63
}
64
64
} ,
65
65
handleFormSubmit : ( event ) => {
66
- const context = getContext ( ) ;
67
- if ( context . speculativeLoadUrl ) {
68
- event . preventDefault ( ) ;
69
- location . href = context . speculativeLoadUrl ;
70
- }
66
+ event . preventDefault ( ) ;
67
+ const form = event . target ;
68
+ const formData = new FormData ( form ) ;
69
+ const url = new URL ( form . action ) ;
70
+ url . search = new URLSearchParams ( formData ) . toString ( ) ;
71
+ location . href = url . href ;
71
72
} ,
72
73
} ,
73
74
} ) ;
You can’t perform that action at this time.
0 commit comments