Skip to content

Commit 826bfcc

Browse files
committed
test: debugging
1 parent 86403a4 commit 826bfcc

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

frontend/src/app/upgrade/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,18 @@ export default function PricingTokenPage() {
4949

5050
// Initialize upgrade flow when component mounts or token changes
5151
useEffect(() => {
52+
console.log('Upgrade page useEffect - token:', token, 'initializedRef:', initializedRef.current);
5253
// Reset the initialized flag when token changes
5354
if (token !== initializedRef.current) {
5455
initializedRef.current = null;
5556
}
5657

5758
if (token && !initializedRef.current) {
59+
console.log('Calling initializeUpgrade with token:', token);
5860
initializeUpgrade(token);
5961
initializedRef.current = token;
6062
} else if (!token) {
63+
console.log('No token, calling reset');
6164
reset();
6265
initializedRef.current = null;
6366
}

frontend/src/stores/use-config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ export const useConfig = create<ConfigState>((set, get) => ({
3535
setError: (error) => set({ error, loading: false }),
3636

3737
loadConfig: async () => {
38+
console.log('loadConfig called');
3839
const state = get();
39-
if (state.loading) return; // Prevent multiple simultaneous requests
40+
console.log('current state loading:', state.loading);
41+
if (state.loading) {
42+
console.log('loadConfig: already loading, returning early');
43+
return; // Prevent multiple simultaneous requests
44+
}
4045

46+
console.log('loadConfig: setting loading to true');
4147
set({ loading: true, error: null });
4248

4349
try {
50+
console.log('loadConfig: about to fetch /api/config');
4451
const response = await fetch('/api/config');
4552
console.log('config response', response);
4653
if (!response.ok) {
@@ -69,5 +76,6 @@ export const useConfig = create<ConfigState>((set, get) => ({
6976

7077
// Initialize config on store creation (only in browser environment)
7178
if (typeof window !== 'undefined') {
79+
console.log('Initializing config store in browser');
7280
useConfig.getState().loadConfig();
7381
}

frontend/src/stores/use-upgrade.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@ export const useUpgrade = create<UpgradeState>((set, get) => ({
8888

8989
// Complex actions
9090
loadConfig: async () => {
91+
console.log('useUpgrade loadConfig called');
9192
try {
9293
const configStore = useConfig.getState();
94+
console.log('configStore state before load:', configStore);
9395

9496
// Always try to load config from API to ensure we have the latest
97+
console.log('calling configStore.loadConfig()');
9598
await configStore.loadConfig();
9699

97100
// Get the config from the config store after loading

0 commit comments

Comments
 (0)