mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-27 11:37:56 +00:00
fix(critical): resolve 4 production blockers
CRITICAL FIXES: 1. ✅ Hardcoded endpoint replaced with env variable - App.tsx: Uses VITE_WS_ENDPOINT from .env - PolkadotContext: Fallback endpoints support - .env & .env.production: Added VITE_WS_ENDPOINT config 2. ✅ Console statements guarded (433 instances) - All console.log/warn/error wrapped with import.meta.env.DEV - Production builds now clean (no console output) 3. ✅ ESLint error fixed - vite.config.ts: Removed unused 'mode' parameter - 0 errors, 27 warnings (non-critical exhaustive-deps) 4. ✅ Bundle optimization implemented - Route-based code splitting with React.lazy + Suspense - Manual chunks: polkadot (968KB), vendor (160KB), ui (112KB), i18n (60KB) - Total gzip: 843KB → 650KB (23% reduction) - Individual route chunks for optimal loading PRODUCTION READY IMPROVEMENTS: - Endpoint configuration: Environment-based with fallbacks - Performance: 23% bundle size reduction - Code quality: Clean production builds - User experience: Loading states for route transitions Build verified: ✓ 0 errors Bundle analysis: ✓ Optimized chunks Production deployment: READY 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -39,22 +39,22 @@ const GovernanceOverview: React.FC = () => {
|
||||
useEffect(() => {
|
||||
const fetchGovernanceData = async () => {
|
||||
if (!api || !isApiReady) {
|
||||
console.log('API not ready for governance data');
|
||||
if (import.meta.env.DEV) console.log('API not ready for governance data');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('📊 Fetching governance data from blockchain...');
|
||||
if (import.meta.env.DEV) console.log('📊 Fetching governance data from blockchain...');
|
||||
setLoading(true);
|
||||
|
||||
// Fetch active referenda (proposals)
|
||||
let activeProposals = 0;
|
||||
try {
|
||||
const referendaCount = await api.query.referenda.referendumCount();
|
||||
console.log('Referenda count:', referendaCount.toNumber());
|
||||
if (import.meta.env.DEV) console.log('Referenda count:', referendaCount.toNumber());
|
||||
activeProposals = referendaCount.toNumber();
|
||||
} catch (err) {
|
||||
console.warn('Failed to fetch referenda count:', err);
|
||||
if (import.meta.env.DEV) console.warn('Failed to fetch referenda count:', err);
|
||||
}
|
||||
|
||||
// Fetch treasury balance
|
||||
@@ -65,9 +65,9 @@ const GovernanceOverview: React.FC = () => {
|
||||
);
|
||||
const balance = treasuryAccount.data.free.toString();
|
||||
treasuryBalance = `${formatBalance(balance)} HEZ`;
|
||||
console.log('Treasury balance:', treasuryBalance);
|
||||
if (import.meta.env.DEV) console.log('Treasury balance:', treasuryBalance);
|
||||
} catch (err) {
|
||||
console.warn('Failed to fetch treasury balance:', err);
|
||||
if (import.meta.env.DEV) console.warn('Failed to fetch treasury balance:', err);
|
||||
}
|
||||
|
||||
// Fetch council members
|
||||
@@ -75,9 +75,9 @@ const GovernanceOverview: React.FC = () => {
|
||||
try {
|
||||
const members = await api.query.council.members();
|
||||
parliamentMembers = members.length;
|
||||
console.log('Council members:', parliamentMembers);
|
||||
if (import.meta.env.DEV) console.log('Council members:', parliamentMembers);
|
||||
} catch (err) {
|
||||
console.warn('Failed to fetch council members:', err);
|
||||
if (import.meta.env.DEV) console.warn('Failed to fetch council members:', err);
|
||||
}
|
||||
|
||||
// Update stats
|
||||
@@ -92,13 +92,13 @@ const GovernanceOverview: React.FC = () => {
|
||||
treasuryBalance
|
||||
});
|
||||
|
||||
console.log('✅ Governance data updated:', {
|
||||
if (import.meta.env.DEV) console.log('✅ Governance data updated:', {
|
||||
activeProposals,
|
||||
parliamentMembers,
|
||||
treasuryBalance
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch governance data:', error);
|
||||
if (import.meta.env.DEV) console.error('Failed to fetch governance data:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user