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:
parent
9242b3fe5f
commit
eeca437586
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue