pub fn try_get_global_state<'a, R>(
        &self,
        cx: Scope<'a>,
    ) -> Result<
        Option<
            // Note: I am sorry.
            <<<<R as RxRef>::RxNonRef as MakeUnrx>::Unrx as MakeRx>::Rx as MakeRxRef>::RxRef<'a>,
        >,
        ClientError,
    >
    where
        R: RxRef,
        // We need this so that the compiler understands that the reactive version of the
        // unreactive version of `R` has the same properties as `R` itself
        <<<R as RxRef>::RxNonRef as MakeUnrx>::Unrx as MakeRx>::Rx:
            Clone + AnyFreeze + MakeUnrx + MakeRxRef,
        <R as RxRef>::RxNonRef: MakeUnrx + AnyFreeze + Clone,
    {
        let global_state_ty = self.global_state.0.borrow();
        // Bail early if the app doesn't support global state
        if let GlobalStateType::None = *global_state_ty {
            return Ok(None);
        }
        // Check if there's an actively loaded state or a frozen state (note
        // that this will set up global state if there was something in the frozen data,
        // hence it needs any other borrows to be dismissed)
        drop(global_state_ty);
        let rx_state = if let Some(rx_state) =
            self.get_active_or_frozen_global_state::<<R as RxRef>::RxNonRef>()
        {
            rx_state
        } else {
            // There was nothing, so we'll load from the server
            let global_state_ty = self.global_state.0.borrow();
            if let GlobalStateType::Server(server_state) = &*global_state_ty {
                let server_state = server_state.clone();
                let server_state =
                    server_state.change_type::<<<R as RxRef>::RxNonRef as MakeUnrx>::Unrx>();
                // The registration borrows mutably, so we have to drop here
                drop(global_state_ty);
                self.register_global_state_value::<<R as RxRef>::RxNonRef>(server_state)?
            } else {
                // We bailed on `None` earlier, and `.get_active_or_frozen_global_state()`
                // would've caught `Loaded`
                unreachable!()
            }
        };

        // Now use the context we have to convert that to a reference struct
        let ref_rx_state = rx_state.to_ref_struct(cx);

        Ok(Some(ref_rx_state))
    }
The underlying logic for `.get_global_state()`, except this will return
`None` if the app does not have global state.

This will return an error if the state from the server was found to be
invalid.
packages/perseus/src/template/render_ctx.rs