arazni / blades-in-the-sheets

A Blades in the Dark character sheet progressive web app in WebAssembly
https://arazni.github.io/blades-in-the-sheets/
6 stars 1 forks source link

Stash event and razor component interaction with Character.Empty() #2

Open arazni opened 1 year ago

arazni commented 1 year ago

Goal: Be able to remove the line from CharacterSheet.razor that returns early if Character is null.

Character.Empty() was intended to allow components to start rendering and stuff while waiting for load. However, because the Coins events are part of the model rather than part of SheetJank, components initialize by subscribing for changes on the character object created by Character.Empty().

Likely instead need to override OnParametersSet() and check if the Character.Id changes. If it does, then unsubscribe from the old events on the empty character and subscribe to the events on the real character.