Represents the primary front-end state "Source of Truth",
as well as the main interface to any underlying native calls /
Snowstorm SDK, and synchronizes with rust state.
Generally, rust state is recognized as higher level and more "truthy" than
the state that is stored in the front-end, and so updates from rust should
override current typescript state.
However, there are cases where the UI has more up-to-date information (user
executed some action/intention) and must behave in a more
responsive-to-users way, or the SDK is wrapped in an App Extension that is
currently not online and so therefore not reachable, so this ts context
must still remain internally consistent, "correct", and on occasion,
override rust state.
IMPORTANT: While it is possible to do RPCs/fetch directly from typescript-land,
and previously we did while prototyping, all network calls must pass through
the rust-side of the app, which contains the proper fallback handlers for
resiliency.
Requirements for Snowstorm Context:
Accurately track and represent App State & flows during usage.
Trigger SDK / Network stack calls and important App Lifecycle.
Prevent Frontend UI/UX from breaking due to any issues, inconsistencies,
errors, etc. from any layer below.
Optional:
Can be hooked to the Snowstorm Globe component. In this case, utilizes
callbacks to update Globe visual state. Markers and arcs represent Peers
and Circuit(s) being established; in this way, the visual flair of the
Globe is also organized in one place and statelessly mirrors the non-globe
Route View, while avoiding any breakage if or when Globe component is
unavailable.
Snowstorm's main frontend "Context"
Uses SolidJS Stores and Context idioms. (See: https://docs.solidjs.com/concepts/context)
Represents the primary front-end state "Source of Truth", as well as the main interface to any underlying native calls / Snowstorm SDK, and synchronizes with rust state.
Requirements for Snowstorm Context:
Optional:
@author: SΞRΞNE (@keroserene)
© Snowstorm Inc. 2024+