Skip to content

Conversation

@schrodingers-cat-T10
Copy link

  • [🐛 Bug fix]

Description

This PR fixes a render-time crash in the Hotelling Law Solara example
caused by accessing agent.cell.coordinate before it is fully
initialized.

When using CellAgent with OrthogonalMooreGrid, Solara may render
before all cells have stable coordinates resulting in intermittent NoneType errors.

Why this actually matters !

  • Prevents confusing crashes for new Mesa users
  • Aligns visualization with Mesa 3.x discrete-space semantics
  • Improves robustness under Solara hot reload

Glad to contribute !

@quaquel
Copy link
Member

quaquel commented Dec 18, 2025

Can you elaborate on the bug you are trying to fix and give an example that produces the bug?

@schrodingers-cat-T10
Copy link
Author

@quaquel the bug popped up right way after running the application by crashing the solara site

I belive solara UI renders before updating the position of the agent in the cell

so i fixed this by adding defensive checks to skip agents whose cell or coordinate is not yet available.
This prevents render-time crashes without changing any model behavior.

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