Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Fix auto sync on extension open, update icon sizes (#900)

Leendert de Borstd66dee35838a
diff --git a/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx b/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx
index 6b706ea72..198347f23 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx
@@ -153,7 +153,7 @@ export const FormInput = forwardRef<HTMLInputElement, FormInputProps>(({
title={button.title}
className="p-1 text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200"
>
- <svg className="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<Icon name={button.icon} />
</svg>
</button>
diff --git a/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx b/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx
index 5aae6cfc9..e489e06bb 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx
@@ -114,7 +114,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =
className="p-1 text-green-500 dark:text-green-400 transition-colors duration-200"
title="Copied!"
>
- <svg className="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<Icon name="check" />
</svg>
</button>
@@ -125,7 +125,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =
className="p-1 text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200"
title="Copy to clipboard"
>
- <svg className="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<Icon name="copy" />
</svg>
</button>
@@ -137,7 +137,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =
className="p-1 text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200"
title={showPassword ? 'Hide password' : 'Show password'}
>
- <svg className="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<Icon name={showPassword ? 'visibility-off' : 'visibility'} />
</svg>
</button>
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/CredentialAddEdit.tsx b/apps/browser-extension/src/entrypoints/popup/pages/CredentialAddEdit.tsx
index 2e6ab0859..a5bfac289 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/CredentialAddEdit.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/CredentialAddEdit.tsx
@@ -256,8 +256,9 @@ const CredentialAddEdit: React.FC = () => {
*/
const onSubmit = useCallback(async (data: Credential): Promise<void> => {
// Normalize the birth date for database entry.
- if (data?.Alias?.BirthDate) {
- data.Alias.BirthDate = IdentityHelperUtils.normalizeBirthDateForDb(data.Alias.BirthDate);
+ let birthdate = data.Alias.BirthDate;
+ if (birthdate) {
+ birthdate = IdentityHelperUtils.normalizeBirthDateForDb(birthdate);
}
// If we're creating a new credential and mode is random, generate random values here
@@ -269,7 +270,7 @@ const CredentialAddEdit: React.FC = () => {
data.Alias.FirstName = watch('Alias.FirstName');
data.Alias.LastName = watch('Alias.LastName');
data.Alias.NickName = watch('Alias.NickName');
- data.Alias.BirthDate = watch('Alias.BirthDate');
+ data.Alias.BirthDate = birthdate;
data.Alias.Gender = watch('Alias.Gender');
data.Alias.Email = watch('Alias.Email');
}
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
index c8e6e1bec..7620b1051 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
@@ -79,13 +79,14 @@ const CredentialsList: React.FC = () => {
}, [dbContext, webApi, syncVault]);
/**
- * Manually refresh the credentials list.
+ * Get latest vault from server and refresh the credentials list.
*/
- const onManualRefresh = async (): Promise<void> => {
+ const syncVaultAndRefresh = useCallback(async () : Promise<void> => {
setIsLoading(true);
await onRefresh();
setIsLoading(false);
- };
+ setIsInitialLoading(false);
+ }, [onRefresh, setIsLoading, setIsInitialLoading]);
// Set header buttons on mount and clear on unmount
useEffect((): (() => void) => {
@@ -108,7 +109,7 @@ const CredentialsList: React.FC = () => {
*/
useEffect(() => {
/**
- * Refresh credentials list when sqlite client is available.
+ * Refresh credentials list when a (new) sqlite client is available.
*/
const refreshCredentials = async () : Promise<void> => {
if (dbContext?.sqliteClient) {
@@ -116,14 +117,16 @@ const CredentialsList: React.FC = () => {
const results = dbContext.sqliteClient?.getAllCredentials() ?? [];
setCredentials(results);
setIsLoading(false);
-
- // Hide the global app initial loading state after the credentials list is loaded.
- setIsInitialLoading(false);
}
};
refreshCredentials();
- }, [dbContext?.sqliteClient, setIsLoading, setIsInitialLoading]);
+ }, [dbContext?.sqliteClient, setIsLoading]);
+
+ // Call syncVaultAndRefresh when the page first mounts
+ useEffect(() => {
+ syncVaultAndRefresh();
+ }, [syncVaultAndRefresh]);
// Add this function to filter credentials
const filteredCredentials = credentials.filter(cred => {
@@ -149,7 +152,7 @@ const CredentialsList: React.FC = () => {
<div>
<div className="flex justify-between items-center mb-4">
<h2 className="text-gray-900 dark:text-white text-xl">Credentials</h2>
- <ReloadButton onClick={onManualRefresh} />
+ <ReloadButton onClick={syncVaultAndRefresh} />
</div>
{credentials.length > 0 ? (