Skip to content

Conversation

@highperformancecoder
Copy link
Owner

@highperformancecoder highperformancecoder commented Jan 22, 2026

…s, for #1466.

Also arrange for Godley popups to refresh all other Godley popups on finishing editing.


This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Godley popups now synchronize across all open windows for consistent, real-time updates.
    • Godley widget refresh is now event-driven, enabling global refreshes across windows.
  • Bug Fixes

    • Godley widget editor now automatically balances duplicate columns when exiting edit mode.

✏️ Tip: You can customize this high-level summary in your review settings.

…s, for #1466.

Also arrange for Godley popups to refresh all other Godley popups on finishing editing.
Copilot AI review requested due to automatic review settings January 22, 2026 04:17
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds an event-driven cross-window Godley popup refresh (new shared event constant, IPC listener, and WindowManager broadcaster), changes Godley widget to emit that event instead of calling refresh directly, calls balanceDuplicateColumns on Godley icon mouse-leave, and updates two submodule pointers and Makefile LD_LIBRARY_PATH.

Changes

Cohort / File(s) Summary
Event Constant
gui-js/libs/shared/src/lib/constants/constants.ts
Adds REFRESH_ALL_GODLEY_POPUPS to exported events.
IPC Listener
gui-js/apps/minsky-electron/src/app/events/electron.events.ts
Registers IPC listener for REFRESH_ALL_GODLEY_POPUPS that invokes WindowManager.refreshAllGodleyPopups().
Window Manager
gui-js/apps/minsky-electron/src/app/managers/WindowManager.ts
Adds static refreshAllGodleyPopups() to iterate activeWindows and send events.GODLEY_POPUP_REFRESH to non-main windows (try/catch around sends).
UI Component
gui-js/libs/ui-components/src/lib/godley-widget-view/godley-widget-view.component.ts
Changes hardRefresh signature to parameterless and replaces direct refresh call with emitting REFRESH_ALL_GODLEY_POPUPS.
Model Behavior
model/godleyIcon.cc
onMouseLeave() now calls balanceDuplicateColumns() before clearing selection and calling update().
Submodules & Build
RavelCAPI (submodule), ecolab (submodule), Makefile
Submodule pointers updated; Makefile export extends LD_LIBRARY_PATH with /usr/local/lib64.

Sequence Diagram

sequenceDiagram
    actor User
    participant Renderer as "GodleyWidgetView (Renderer)"
    participant Main as "Electron Main"
    participant WindowMgr as "WindowManager (Main)"
    participant Other as "Other Renderer Window"

    User->>Renderer: trigger hardRefresh()
    Renderer->>Main: emit REFRESH_ALL_GODLEY_POPUPS
    Main->>WindowMgr: forward REFRESH_ALL_GODLEY_POPUPS
    WindowMgr->>WindowMgr: iterate activeWindows
    WindowMgr->>Other: send GODLEY_POPUP_REFRESH
    Other->>Other: refresh Godley popups
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I twitch my nose and tap the key,
A tiny event hops across each pane,
Popups stir and blink for me,
Columns balance, neat and plain,
I nibble code and hum—hooray!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main objective: arranging for Godley tables to refresh all other Godley tables on the canvas, which aligns with the implementation of event-driven refresh mechanisms across the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements functionality to refresh all Godley tables and popups when changes are made, addressing issue #1466. The changes ensure that when a user finishes editing in one Godley table or popup, all other related instances are automatically updated to reflect those changes.

Changes:

  • Added backend support to balance duplicate columns across Godley tables
  • Implemented IPC event handling to trigger refresh of all Godley popups
  • Modified the Godley widget component to send refresh events instead of local-only updates

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
model/godleyIcon.cc Adds call to balance duplicate columns when exiting editor mode
gui-js/libs/ui-components/src/lib/godley-widget-view/godley-widget-view.component.ts Changes local refresh to broadcast refresh event to all Godley popups
gui-js/libs/shared/src/lib/constants/constants.ts Defines new IPC event constant for refreshing all Godley popups
gui-js/apps/minsky-electron/src/app/managers/WindowManager.ts Implements method to send refresh events to all Godley popup windows
gui-js/apps/minsky-electron/src/app/events/electron.events.ts Registers IPC handler for the refresh all Godley popups event
RavelCAPI Updates subproject commit reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

static refreshAllGodleyPopups() {
for (const [num, win] of WindowManager.activeWindows)
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop variable 'num' is declared but never used. Consider using an underscore to indicate it's intentionally unused: for (const [_num, win] of WindowManager.activeWindows).

Suggested change
for (const [num, win] of WindowManager.activeWindows)
for (const [_num, win] of WindowManager.activeWindows)

Copilot uses AI. Check for mistakes.
);

ipcMain.on(
events.REFRESH_ALL_GODLEY_POPUPS,async (event) => {
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after the comma before 'async' for consistent formatting: events.REFRESH_ALL_GODLEY_POPUPS, async (event) => {.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

);

ipcMain.on(
events.REFRESH_ALL_GODLEY_POPUPS,async (event) => {
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'event' parameter is declared but never used in the handler. Consider using an underscore to indicate it's intentionally unused: async (_event) => {.

Suggested change
events.REFRESH_ALL_GODLEY_POPUPS,async (event) => {
events.REFRESH_ALL_GODLEY_POPUPS,async (_event) => {

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
model/godleyIcon.cc (1)

630-639: Guard against invalid selected column before balancing.

Line 635 calls balanceDuplicateColumns even when editor.selectedCol may be -1. If the callee assumes a valid column index, this can cause out-of-range behavior or unintended updates.

🛠️ Proposed fix
-        minsky().balanceDuplicateColumns(*this, editor.selectedCol);
+        if (editor.selectedCol >= 0)
+          minsky().balanceDuplicateColumns(*this, editor.selectedCol);
🧹 Nitpick comments (1)
gui-js/apps/minsky-electron/src/app/managers/WindowManager.ts (1)

375-378: Remove unused loop variable to satisfy static analysis.

Line 376 binds num but never uses it.

♻️ Suggested tweak
-    for (const [num, win] of WindowManager.activeWindows)
+    for (const [, win] of WindowManager.activeWindows)
       if (win.context!=WindowManager.getMainWindow())
         win.context?.webContents?.send(events.GODLEY_POPUP_REFRESH);

…rt, function or class

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Jan 22, 2026

@highperformancecoder I've opened a new pull request, #600, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@gui-js/apps/minsky-electron/src/app/managers/WindowManager.ts`:
- Around line 375-379: The refreshAllGodleyPopups loop can call webContents.send
on destroyed objects; update WindowManager.refreshAllGodleyPopups to skip any
entry where the BrowserWindow is destroyed or where its webContents is missing
or destroyed (check win.context?.isDestroyed() and
win.context.webContents?.isDestroyed()) and continue if it is the main window
via WindowManager.getMainWindow(); only call
webContents.send(events.GODLEY_POPUP_REFRESH) when both the window and its
webContents are present and not destroyed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants