Apply updates to fully qualified state vars. The keys in `vars` should be in the form of `{state.get_full_name()}.{var_name}`, and each value will be set on the appropriate substate instance. This function is primarily used to apply cookie and local storage updates
(self, vars: dict[str, Any])
| 2419 | """Substate for handling internal state var updates.""" |
| 2420 | |
| 2421 | async def update_vars_internal(self, vars: dict[str, Any]) -> None: |
| 2422 | """Apply updates to fully qualified state vars. |
| 2423 | |
| 2424 | The keys in `vars` should be in the form of `{state.get_full_name()}.{var_name}`, |
| 2425 | and each value will be set on the appropriate substate instance. |
| 2426 | |
| 2427 | This function is primarily used to apply cookie and local storage |
| 2428 | updates from the frontend to the appropriate substate. |
| 2429 | |
| 2430 | Args: |
| 2431 | vars: The fully qualified vars and values to update. |
| 2432 | """ |
| 2433 | for var, value in vars.items(): |
| 2434 | state_name, _, var_name = var.rpartition(".") |
| 2435 | var_name = var_name.removesuffix(FIELD_MARKER) |
| 2436 | var_state_cls = State.get_class_substate(state_name) |
| 2437 | if var_state_cls._is_client_storage(var_name): |
| 2438 | var_state = await self.get_state(var_state_cls) |
| 2439 | setattr(var_state, var_name, value) |
| 2440 | |
| 2441 | |
| 2442 | class OnLoadInternalState(State): |
nothing calls this directly
no test coverage detected