pub(crate) fn get_page_state<S>(
        &self,
        url: &PathMaybeWithLocale,
        server_state: TemplateState,
    ) -> Result<S::Rx, ClientError>
    where
        S: MakeRx + Serialize + DeserializeOwned + 'static,
        S::Rx: MakeUnrx<Unrx = S> + AnyFreeze + Clone,
    {
        if let Some(held_state) = self.get_held_state::<S>(url, false)? {
            Ok(held_state)
        } else if server_state.is_empty() {
            Err(ClientInvariantError::NoState.into())
        } else {
            // Fall back to the state we were given, first
            // giving it a type (this just sets a phantom type parameter)
            let typed_state = server_state.change_type::<S>();
            // This attempts a deserialization from a `Value`, which could fail
            let unrx = typed_state
                .into_concrete()
                .map_err(|err| ClientInvariantError::InvalidState { source: err })?;
            let rx = unrx.make_rx();
            // Add that to the state store as the new active state
            self.state_store.add_state(url, rx.clone(), false)?;

            Ok(rx)
        }
    }
Gets the intermediate state type for the given page by evaluating active
and frozen state to see if anything else is available, reverting to
the provided state from the server if necessary.

This will return an invariant error if the provided server state is
invalid, since it's assumed to have actually come from the server.
It is also expected that the given path does actually take state!

This should not be used for capsules!
packages/perseus/src/reactor/state.rs