Fix: Setup-Wizard Redirect + market_news Migration

- Replace navigate() with window.location.href for full page reload
  after setup completion (fixes redirect loop back to /setup)
- Add migration 002: market_news table with indexes
- Remove unused useNavigate import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sam 2026-03-02 16:32:43 +01:00
parent c15176bff4
commit 94cf618e0d
2 changed files with 24 additions and 3 deletions

View file

@ -0,0 +1,22 @@
-- Migration 002: Market News table
-- Written by n8n workflows, read by the dashboard.
CREATE TABLE IF NOT EXISTS market_news (
id SERIAL PRIMARY KEY,
source VARCHAR(200) NOT NULL DEFAULT '',
title TEXT NOT NULL,
url TEXT NOT NULL DEFAULT '',
category VARCHAR(100),
published_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_market_news_published
ON market_news (published_at DESC);
CREATE INDEX IF NOT EXISTS idx_market_news_category
ON market_news (category);
-- Record this migration
INSERT INTO schema_version (version, description)
VALUES (2, 'market_news table for n8n-sourced articles')
ON CONFLICT (version) DO NOTHING;

View file

@ -1,5 +1,4 @@
import { useState } from "react"; import { useState } from "react";
import { useNavigate } from "react-router-dom";
import { import {
Lock, Cloud, Home, ListTodo, Server, Radio, Newspaper, Webhook, Lock, Cloud, Home, ListTodo, Server, Radio, Newspaper, Webhook,
ArrowRight, ArrowLeft, SkipForward, CheckCircle2, Loader2, ArrowRight, ArrowLeft, SkipForward, CheckCircle2, Loader2,
@ -47,7 +46,6 @@ interface ServerEntry {
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
export default function SetupWizard() { export default function SetupWizard() {
const navigate = useNavigate();
const [step, setStep] = useState(0); const [step, setStep] = useState(0);
const [busy, setBusy] = useState(false); const [busy, setBusy] = useState(false);
const [error, setError] = useState(""); const [error, setError] = useState("");
@ -164,7 +162,8 @@ export default function SetupWizard() {
if (token) { if (token) {
setAuth(token, "admin"); setAuth(token, "admin");
} }
navigate("/", { replace: true }); // Full reload so App.tsx re-checks setup status from server
window.location.href = "/";
} catch (err: any) { } catch (err: any) {
setError(err.message); setError(err.message);
} finally { } finally {