Skip to content

Commit 19ccb9a

Browse files
committed
fix(topbar): fix error on first render on slow systems
1 parent e31ce17 commit 19ccb9a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/opencode/ui/topbar.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ local function format_token_info()
1818
local provider, model = state.current_model:match('^(.-)/(.+)$')
1919
local model_info = config_file.get_model_info(provider, model)
2020
local limit = state.tokens_count and model_info and model_info.limit and model_info.limit.context or 0
21-
table.insert(parts, util.format_number(state.tokens_count))
21+
table.insert(parts, util.format_number(state.tokens_count) or nil)
2222
if limit > 0 then
23-
table.insert(parts, util.format_percentage(state.tokens_count / limit))
23+
table.insert(parts, util.format_percentage(state.tokens_count / limit) or nil)
2424
end
2525
end
26-
if config.ui.display_cost then
27-
table.insert(parts, util.format_cost(state.cost))
26+
if config.ui.display_cost and state.cost then
27+
table.insert(parts, util.format_cost(state.cost) or nil)
2828
end
2929
end
3030

0 commit comments

Comments
 (0)