The deployedModels selector used .filter() which created a new array reference on every store change, triggering cascading re-renders. Changed to compute bestQuality as a primitive directly in the selector. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,13 +15,12 @@ export function MarketPage() {
|
||||
const tokensDemand = useGameStore((s) => s.compute.tokensPerSecondDemand);
|
||||
const currentEra = useGameStore((s) => s.meta.currentEra);
|
||||
const reputationScore = useGameStore((s) => s.reputation.score);
|
||||
const deployedModels = useGameStore((s) => s.models.trainedModels.filter(m => m.isDeployed));
|
||||
const bestQuality = useGameStore((s) => {
|
||||
const deployed = s.models.trainedModels.filter(m => m.isDeployed);
|
||||
return deployed.length > 0 ? Math.max(...deployed.map(m => m.benchmarkScore)) / 100 : 0;
|
||||
});
|
||||
const setProductPricing = useGameStore((s) => s.setProductPricing);
|
||||
const setOverloadPolicy = useGameStore((s) => s.setOverloadPolicy);
|
||||
|
||||
const bestQuality = deployedModels.length > 0
|
||||
? Math.max(...deployedModels.map(m => m.benchmarkScore)) / 100
|
||||
: 0;
|
||||
const eraCapBase = MARKET_SIZE_CAP[currentEra] ?? 100_000_000;
|
||||
const effectiveCap = eraCapBase
|
||||
* (1 + bestQuality * MARKET_CAP_QUALITY_BONUS)
|
||||
|
||||
Reference in New Issue
Block a user