Bug
In src/lib/onboard-session.ts, normalizeSession copies metadata.gatewayName without checking its type. A persisted payload like { "metadata": { "gatewayName": 123 } } survives normalization, so loadSession() can return a Session where metadata.gatewayName is not a string.
Fix
Add typeof gatewayName === "string" check before copying it into the normalized session.
Found by
CodeRabbit review on #1272. Pre-existing from original JS.
Bug
In
src/lib/onboard-session.ts,normalizeSessioncopiesmetadata.gatewayNamewithout checking its type. A persisted payload like{ "metadata": { "gatewayName": 123 } }survives normalization, soloadSession()can return a Session wheremetadata.gatewayNameis not a string.Fix
Add
typeof gatewayName === "string"check before copying it into the normalized session.Found by
CodeRabbit review on #1272. Pre-existing from original JS.