Download & Extend

Stale state when loaded outside hook

Project:Game
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

This is more of a general "known problem" instead of a workable action. Collecting notes, mostly.

In short: all our hooks pass around the entire game $state. But, if a module needs to load the game state outside of a hook, they will almost always get a game state that is NOT accurate (since it'd be coming from the database, and not the in-progress page load, where it has probably gotten changed). One solution would be to load game state into a global, but that could potentially cause problems with multiple game states being loaded at once (which is a distinct possibility in a 2+ player environment). Ideally, our hooks would be so awesome and so detailed that there'd never be a reason to load a game state outside of the normal workflow.

This doesn't need to be solved right now. Game has no users to complain about it.

Comments

#1

Title:Loading state outside a hook is dangerous» Stale state when loaded outside hook