fix: Onboarding, account not shown on the import drawer (#121)

During the onboarding, you create your account but, sometimes it does
not appear on the next import transaction step. With this changes we are
reloading them.
This commit is contained in:
Víctor Falcón 2026-02-13 11:09:55 +01:00 committed by GitHub
parent 9242b3fe5f
commit eeca437586
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -6,7 +6,7 @@ import { type Account, type Bank } from '@/types/account';
import { type AutomationRule } from '@/types/automation-rule';
import { type Category } from '@/types/category';
import { __ } from '@/utils/i18n';
import { usePage } from '@inertiajs/react';
import { router, usePage } from '@inertiajs/react';
import { ArrowRight, FileSpreadsheet, Upload } from 'lucide-react';
import { useEffect, useMemo, useState } from 'react';
@ -28,6 +28,15 @@ export function StepImportTransactions({
automationRules: AutomationRule[];
}>().props;
// Refresh shared props so the newly created account is available
useEffect(() => {
if (accounts.length === 0) {
router.reload({
only: ['accounts', 'categories', 'banks', 'automationRules'],
});
}
}, [accounts.length]);
const handleDrawerClose = (open: boolean) => {
setIsDrawerOpen(open);
if (!open) {