diff --git a/src/home.zig b/src/home.zig index 18fe337..0d49215 100644 --- a/src/home.zig +++ b/src/home.zig @@ -57,6 +57,7 @@ fn fetchThread(state: *AppState) !void { continue; }; defer parsed.deinit(); + std.debug.print("[home/fetchThread] Parsed data\n", .{}); var results = std.ArrayList(AppState.HSSuggestion).init(allocator); for (parsed.value) |station| { @@ -72,9 +73,11 @@ fn fetchThread(state: *AppState) !void { } } } + std.debug.print("[home/fetchThread] Created results: {} stations\n", .{results.items.len}); state.home_screen_state.mutex.lock(); defer state.home_screen_state.mutex.unlock(); if (state.home_screen_state.suggestions.len > 0) { + std.debug.print("[home/fetchThread] Deallocating previous data\n", .{}); for (state.home_screen_state.suggestions) |suggestion| { allocator.free(suggestion.id); allocator.free(suggestion.name); @@ -82,6 +85,7 @@ fn fetchThread(state: *AppState) !void { allocator.free(state.home_screen_state.suggestions); } state.home_screen_state.suggestions = results.toOwnedSlice() catch continue; + std.debug.print("[home/fetchThread] Replaced suggestions\n", .{}); } }