Skip to content

Commit 2a81585

Browse files
Copilot0xrinegade
andcommitted
Fix critical application crash: resolve variable initialization order issue in App.js
Co-authored-by: 0xrinegade <[email protected]>
1 parent fdebdc7 commit 2a81585

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/App.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ const AppContent = () => {
8888
// Use Phantom wallet context instead of Swig wallet
8989
const wallet = usePhantomWallet();
9090

91+
// State for selected network (must be declared before using in useMemo)
92+
const [selectedNetwork, setSelectedNetwork] = useState('solana');
93+
const [activeTab, setActiveTab] = useState('buy'); // 'buy', 'sell', 'myoffers', 'disputes', 'profile'
94+
const [isGuidedWorkflow, setIsGuidedWorkflow] = useState(false);
95+
const [guidedWorkflowType, setGuidedWorkflowType] = useState(null); // 'buy' or 'sell'
96+
97+
// Get network configuration
98+
const network = SVM_NETWORKS[selectedNetwork];
99+
91100
// Create enhanced connection with retry logic for rate limits
92101
const connection = useMemo(() => {
93102
return createConnection(network.endpoint, network.connectionConfig || {
@@ -99,15 +108,6 @@ const AppContent = () => {
99108
// Initialize the Anchor program
100109
const program = useProgram(connection, wallet);
101110

102-
// State for selected network
103-
const [selectedNetwork, setSelectedNetwork] = useState('solana');
104-
const [activeTab, setActiveTab] = useState('buy'); // 'buy', 'sell', 'myoffers', 'disputes', 'profile'
105-
const [isGuidedWorkflow, setIsGuidedWorkflow] = useState(false);
106-
const [guidedWorkflowType, setGuidedWorkflowType] = useState(null); // 'buy' or 'sell'
107-
108-
// Get network configuration
109-
const network = SVM_NETWORKS[selectedNetwork];
110-
111111
// Context values
112112
const contextValue = useMemo(() => ({
113113
network,

0 commit comments

Comments
 (0)