[PR #57] [MERGED] fix: console constructor undefined on rerun #258

Closed
opened 2026-03-02 23:45:39 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/57
Author: @KurtGokhan
Created: 8/23/2025
Status: Merged
Merged: 8/23/2025
Merged by: @kommander

Base: mainHead: issue-41/fix-console-ctor-undefined


📝 Commits (2)

  • 01098c5 fix: console constructor undefined on rerun
  • f89a264 introduce singleton utility and reduce top-level side effects

📊 Changes

8 files changed (+63 additions, -36 deletions)

View changed files

📝 packages/core/src/Renderable.ts (+2 -3)
📝 packages/core/src/buffer.ts (+2 -3)
📝 packages/core/src/console.ts (+29 -19)
📝 packages/core/src/lib/KeyHandler.ts (+2 -1)
📝 packages/core/src/lib/TrackedNode.ts (+2 -3)
📝 packages/core/src/renderer.ts (+8 -6)
packages/core/src/singleton.ts (+14 -0)
📝 packages/core/src/zig.ts (+4 -1)

📄 Description

Fixes new console.Console causing crash as can be seen in #41. This can be reproduced in various ways, but I mainly experience it when running with Bun hot reload (bun run --hot ....).

This PR doesn't aim to fully support hot reload though. Notably, the old TUI isn't destroyed on hot reload, so there will be glitches and memory leaks. But at least this prevents a crash. User can rerun the bun command or use --watch if they want to clear the old instance.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/57 **Author:** [@KurtGokhan](https://github.com/KurtGokhan) **Created:** 8/23/2025 **Status:** ✅ Merged **Merged:** 8/23/2025 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `issue-41/fix-console-ctor-undefined` --- ### 📝 Commits (2) - [`01098c5`](https://github.com/anomalyco/opentui/commit/01098c537c25f0335bb0753f19c29a29806f6353) fix: console constructor undefined on rerun - [`f89a264`](https://github.com/anomalyco/opentui/commit/f89a264bfe617a99feda2aa2b49f34d240d79973) introduce singleton utility and reduce top-level side effects ### 📊 Changes **8 files changed** (+63 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/Renderable.ts` (+2 -3) 📝 `packages/core/src/buffer.ts` (+2 -3) 📝 `packages/core/src/console.ts` (+29 -19) 📝 `packages/core/src/lib/KeyHandler.ts` (+2 -1) 📝 `packages/core/src/lib/TrackedNode.ts` (+2 -3) 📝 `packages/core/src/renderer.ts` (+8 -6) ➕ `packages/core/src/singleton.ts` (+14 -0) 📝 `packages/core/src/zig.ts` (+4 -1) </details> ### 📄 Description Fixes `new console.Console` causing crash as can be seen in #41. This can be reproduced in various ways, but I mainly experience it when running with Bun hot reload (`bun run --hot ....`). This PR doesn't aim to fully support hot reload though. Notably, the old TUI isn't destroyed on hot reload, so there will be glitches and memory leaks. But at least this prevents a crash. User can rerun the bun command or use `--watch` if they want to clear the old instance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:45:39 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#258
No description provided.