fix: synchronize shadow book save state
This commit is contained in:
@@ -41,6 +41,7 @@ export function PerformanceSettings() {
|
||||
const saveBook = useMutation({
|
||||
mutationFn: (payload: Partial<ShadowBookConfig>) => updateShadowBookSettings(payload),
|
||||
onSuccess: (data) => {
|
||||
qc.setQueryData(['admin', 'shadow-book'], data);
|
||||
setBook(data);
|
||||
qc.invalidateQueries({ queryKey: ['admin', 'shadow-book'] });
|
||||
qc.invalidateQueries({ queryKey: ['paper-trades', 'performance'] });
|
||||
@@ -115,8 +116,9 @@ export function PerformanceSettings() {
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={book.enabled}
|
||||
disabled={saveBook.isPending}
|
||||
onChange={(e) => setBook({ ...book, enabled: e.target.checked })}
|
||||
className="mt-0.5"
|
||||
className="mt-0.5 disabled:cursor-wait disabled:opacity-50"
|
||||
/>
|
||||
<span>
|
||||
<span className="text-sm text-gray-200">Shadow book enabled</span>
|
||||
@@ -136,8 +138,9 @@ export function PerformanceSettings() {
|
||||
min={1}
|
||||
max={100}
|
||||
value={book.capacity}
|
||||
disabled={saveBook.isPending}
|
||||
onChange={(e) => setBook({ ...book, capacity: Number(e.target.value) })}
|
||||
className="input-glass w-full px-3 py-2 text-sm"
|
||||
className="input-glass w-full px-3 py-2 text-sm disabled:cursor-wait disabled:opacity-50"
|
||||
/>
|
||||
</label>
|
||||
<label className="block space-y-1">
|
||||
@@ -148,8 +151,9 @@ export function PerformanceSettings() {
|
||||
min={0.05}
|
||||
max={10}
|
||||
value={book.risk_pct}
|
||||
disabled={saveBook.isPending}
|
||||
onChange={(e) => setBook({ ...book, risk_pct: Number(e.target.value) })}
|
||||
className="input-glass w-full px-3 py-2 text-sm"
|
||||
className="input-glass w-full px-3 py-2 text-sm disabled:cursor-wait disabled:opacity-50"
|
||||
/>
|
||||
</label>
|
||||
<label className="block space-y-1">
|
||||
@@ -159,8 +163,9 @@ export function PerformanceSettings() {
|
||||
min={1000}
|
||||
step={1000}
|
||||
value={book.start_equity}
|
||||
disabled={saveBook.isPending}
|
||||
onChange={(e) => setBook({ ...book, start_equity: Number(e.target.value) })}
|
||||
className="input-glass w-full px-3 py-2 text-sm"
|
||||
className="input-glass w-full px-3 py-2 text-sm disabled:cursor-wait disabled:opacity-50"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user