Describe the bug
When using useAuthState in multiple components across the page (e.g., in a header Auth Control and inside an Endpoint Try Panel), the credentials do not update reactively when changed in one of the components. The state is only synchronized when page reloads because useAuthState reads from sessionStorage in onMounted.
Additionally, typing a credential in the AuthControls input field does not persist until the field loses focus (blur) or the user presses Enter, which causes input values to be lost if a request is immediately sent or if the panel is closed/switched.
Steps to reproduce
- Configure openApiDocs with a spec that uses a security scheme (e.g., bearer token).
- Add multiple
OpenApiEndpoint components or mount multiple components that use useAuthState with the same specName.
- Type a token in the authorization input field of one component.
- Note that the credential is not immediately saved on keypress, and notice that other components referencing the same
specName auth state do not update reactively.
Expected behavior
- Credentials typed in the input field should be committed immediately on input.
- Multiple active hook instances of
useAuthState should share the same underlying reactive ref cache in memory, so changes to authorization state propagate immediately across all components referencing the same spec.
Package version
1.7.1
Node.js version
22.22.2
VitePress version
1.5.0
Describe the bug
When using
useAuthStatein multiple components across the page (e.g., in a header Auth Control and inside an Endpoint Try Panel), the credentials do not update reactively when changed in one of the components. The state is only synchronized when page reloads becauseuseAuthStatereads fromsessionStorageinonMounted.Additionally, typing a credential in the
AuthControlsinput field does not persist until the field loses focus (blur) or the user pressesEnter, which causes input values to be lost if a request is immediately sent or if the panel is closed/switched.Steps to reproduce
OpenApiEndpointcomponents or mount multiple components that useuseAuthStatewith the samespecName.specNameauth state do not update reactively.Expected behavior
useAuthStateshould share the same underlying reactive ref cache in memory, so changes to authorization state propagate immediately across all components referencing the same spec.Package version
1.7.1
Node.js version
22.22.2
VitePress version
1.5.0