Skip to content
Snippets Groups Projects
Commit 0acd59eb authored by Mateusz Żebrak's avatar Mateusz Żebrak
Browse files

Use NotUpdatedYet rather than None in DataProvider

parent ea465607
No related branches found
No related tags found
2 merge requests!600v1.27.5.21 Release,!597Get rid of unneded run_worker
Showing
with 60 additions and 31 deletions
...@@ -13,6 +13,7 @@ from clive.__private.abstract_class import AbstractClassMessagePump ...@@ -13,6 +13,7 @@ from clive.__private.abstract_class import AbstractClassMessagePump
from clive.__private.settings import safe_settings from clive.__private.settings import safe_settings
from clive.__private.ui.clive_screen import CliveScreen from clive.__private.ui.clive_screen import CliveScreen
from clive.__private.ui.clive_widget import CliveWidget from clive.__private.ui.clive_widget import CliveWidget
from clive.__private.ui.not_updated_yet import NotUpdatedYet, is_not_updated_yet
from clive.exceptions import CliveError from clive.exceptions import CliveError
ProviderContentT = TypeVar("ProviderContentT") ProviderContentT = TypeVar("ProviderContentT")
...@@ -26,7 +27,8 @@ class ProviderNotSetYetError(ProviderError): ...@@ -26,7 +27,8 @@ class ProviderNotSetYetError(ProviderError):
_MESSAGE: Final[str] = """ _MESSAGE: Final[str] = """
Provider content was referenced before the update actually occurred. Provider content was referenced before the update actually occurred.
You're probably using it too early. You're probably using it too early.
If you are sure, you can use the `updated` property to check if content is ready or `_content` which may be None.""" If you are sure, you can use the `updated` property to check if content is ready
or `_content` which may be NotUpdatedYet."""
def __init__(self) -> None: def __init__(self) -> None:
super().__init__(self._MESSAGE) super().__init__(self._MESSAGE)
...@@ -41,7 +43,7 @@ class DataProvider(Container, CliveWidget, Generic[ProviderContentT], AbstractCl ...@@ -41,7 +43,7 @@ class DataProvider(Container, CliveWidget, Generic[ProviderContentT], AbstractCl
method, but could be also done by using the provider methods. method, but could be also done by using the provider methods.
""" """
_content: ProviderContentT | None = var(None, init=False) # type: ignore[assignment] _content: ProviderContentT | NotUpdatedYet = var(NotUpdatedYet(), init=False) # type: ignore[assignment]
"""Should be overridden by subclasses to store the data retrieved by the provider.""" """Should be overridden by subclasses to store the data retrieved by the provider."""
updated: bool = var(default=False) # type: ignore[assignment] updated: bool = var(default=False) # type: ignore[assignment]
...@@ -87,13 +89,14 @@ class DataProvider(Container, CliveWidget, Generic[ProviderContentT], AbstractCl ...@@ -87,13 +89,14 @@ class DataProvider(Container, CliveWidget, Generic[ProviderContentT], AbstractCl
@property @property
def content(self) -> ProviderContentT: def content(self) -> ProviderContentT:
if self._content is None: if not self.is_content_set:
raise ProviderNotSetYetError raise ProviderNotSetYetError
assert not isinstance(self._content, NotUpdatedYet), "Already checked."
return self._content return self._content
@property @property
def is_content_set(self) -> bool: def is_content_set(self) -> bool:
return self._content is not None return not is_not_updated_yet(self._content)
def stop(self) -> None: def stop(self) -> None:
self.interval.stop() self.interval.stop()
......
...@@ -4,10 +4,11 @@ from textual.reactive import var ...@@ -4,10 +4,11 @@ from textual.reactive import var
from clive.__private.core.commands.data_retrieval.hive_power_data import HivePowerData from clive.__private.core.commands.data_retrieval.hive_power_data import HivePowerData
from clive.__private.ui.data_providers.abc.data_provider import DataProvider from clive.__private.ui.data_providers.abc.data_provider import DataProvider
from clive.__private.ui.not_updated_yet import NotUpdatedYet
class HivePowerDataProvider(DataProvider[HivePowerData]): class HivePowerDataProvider(DataProvider[HivePowerData]):
_content: HivePowerData | None = var(None, init=False) # type: ignore[assignment] _content: HivePowerData | NotUpdatedYet = var(NotUpdatedYet(), init=False) # type: ignore[assignment]
def __init__(self, *, paused: bool = False, init_update: bool = True) -> None: def __init__(self, *, paused: bool = False, init_update: bool = True) -> None:
super().__init__(paused=paused, init_update=init_update) super().__init__(paused=paused, init_update=init_update)
......
...@@ -6,13 +6,14 @@ from textual.reactive import var ...@@ -6,13 +6,14 @@ from textual.reactive import var
from clive.__private.core.commands.data_retrieval.proposals_data import ProposalsData, ProposalsDataRetrieval from clive.__private.core.commands.data_retrieval.proposals_data import ProposalsData, ProposalsDataRetrieval
from clive.__private.ui.data_providers.abc.data_provider import DataProvider from clive.__private.ui.data_providers.abc.data_provider import DataProvider
from clive.__private.ui.not_updated_yet import NotUpdatedYet
if TYPE_CHECKING: if TYPE_CHECKING:
from textual.worker import Worker from textual.worker import Worker
class ProposalsDataProvider(DataProvider[ProposalsData]): class ProposalsDataProvider(DataProvider[ProposalsData]):
_content: ProposalsData | None = var(None, init=False) # type: ignore[assignment] _content: ProposalsData | NotUpdatedYet = var(NotUpdatedYet(), init=False) # type: ignore[assignment]
def __init__(self, *, paused: bool = False, init_update: bool = True) -> None: def __init__(self, *, paused: bool = False, init_update: bool = True) -> None:
super().__init__(paused=paused, init_update=init_update) super().__init__(paused=paused, init_update=init_update)
......
...@@ -4,12 +4,13 @@ from textual.reactive import var ...@@ -4,12 +4,13 @@ from textual.reactive import var
from clive.__private.core.commands.data_retrieval.savings_data import SavingsData from clive.__private.core.commands.data_retrieval.savings_data import SavingsData
from clive.__private.ui.data_providers.abc.data_provider import DataProvider from clive.__private.ui.data_providers.abc.data_provider import DataProvider
from clive.__private.ui.not_updated_yet import NotUpdatedYet
class SavingsDataProvider(DataProvider[SavingsData]): class SavingsDataProvider(DataProvider[SavingsData]):
"""A class for retrieving information about savings stored in a SavingsData dataclass.""" """A class for retrieving information about savings stored in a SavingsData dataclass."""
_content: SavingsData | None = var(None, init=False) # type: ignore[assignment] _content: SavingsData | NotUpdatedYet = var(NotUpdatedYet(), init=False) # type: ignore[assignment]
"""It is used to check whether savings data has been refreshed and to store savings data.""" """It is used to check whether savings data has been refreshed and to store savings data."""
async def _update(self) -> None: async def _update(self) -> None:
......
...@@ -6,6 +6,7 @@ from textual.reactive import var ...@@ -6,6 +6,7 @@ from textual.reactive import var
from clive.__private.core.commands.data_retrieval.witnesses_data import WitnessesData, WitnessesDataRetrieval from clive.__private.core.commands.data_retrieval.witnesses_data import WitnessesData, WitnessesDataRetrieval
from clive.__private.ui.data_providers.abc.data_provider import DataProvider from clive.__private.ui.data_providers.abc.data_provider import DataProvider
from clive.__private.ui.not_updated_yet import NotUpdatedYet
if TYPE_CHECKING: if TYPE_CHECKING:
from textual.worker import Worker from textual.worker import Worker
...@@ -14,7 +15,7 @@ if TYPE_CHECKING: ...@@ -14,7 +15,7 @@ if TYPE_CHECKING:
class WitnessesDataProvider(DataProvider[WitnessesData]): class WitnessesDataProvider(DataProvider[WitnessesData]):
"""A class for retrieving information about witnesses stored in a WitnessesData dataclass.""" """A class for retrieving information about witnesses stored in a WitnessesData dataclass."""
_content: WitnessesData | None = var(None, init=False) # type: ignore[assignment] _content: WitnessesData | NotUpdatedYet = var(NotUpdatedYet(), init=False) # type: ignore[assignment]
"""It is used to check whether witnesses data has been refreshed and to store witnesses data.""" """It is used to check whether witnesses data has been refreshed and to store witnesses data."""
def __init__(self, *, paused: bool = False, init_update: bool = True) -> None: def __init__(self, *, paused: bool = False, init_update: bool = True) -> None:
......
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, TypeVar
if TYPE_CHECKING:
from typing_extensions import TypeIs
ValueT = TypeVar("ValueT")
def is_not_updated_yet(value: ValueT | NotUpdatedYet) -> TypeIs[NotUpdatedYet]:
"""Check whether the value is an instance of NotUpdatedYet."""
return isinstance(value, NotUpdatedYet)
def is_updated(value: ValueT | NotUpdatedYet) -> TypeIs[ValueT]:
"""Check whether the value is not an instance of NotUpdatedYet."""
return not is_not_updated_yet(value)
class NotUpdatedYet: class NotUpdatedYet:
"""Used to check whether data is not updated yet or it is not present (created to avoid initialization via None).""" """Used to check whether data is not updated yet or it is not present (created to avoid initialization via None)."""
...@@ -11,6 +11,7 @@ from clive.__private.core.formatters.humanize import ( ...@@ -11,6 +11,7 @@ from clive.__private.core.formatters.humanize import (
humanize_hp_vests_apr, humanize_hp_vests_apr,
) )
from clive.__private.ui.clive_widget import CliveWidget from clive.__private.ui.clive_widget import CliveWidget
from clive.__private.ui.not_updated_yet import is_updated
from clive.__private.ui.widgets.apr import APR from clive.__private.ui.widgets.apr import APR
from clive.__private.ui.widgets.dynamic_widgets.dynamic_label import DynamicLabel from clive.__private.ui.widgets.dynamic_widgets.dynamic_label import DynamicLabel
from clive.__private.ui.widgets.section_title import SectionTitle from clive.__private.ui.widgets.section_title import SectionTitle
...@@ -60,7 +61,7 @@ class WithdrawalInfo(Vertical, CliveWidget): ...@@ -60,7 +61,7 @@ class WithdrawalInfo(Vertical, CliveWidget):
"_content", "_content",
self._get_next_withdrawal_date, self._get_next_withdrawal_date,
id_="withdrawal-info-date", id_="withdrawal-info-date",
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
yield SectionTitle("To withdraw", id_="to-withdraw-header") yield SectionTitle("To withdraw", id_="to-withdraw-header")
yield DynamicLabel( yield DynamicLabel(
...@@ -68,14 +69,14 @@ class WithdrawalInfo(Vertical, CliveWidget): ...@@ -68,14 +69,14 @@ class WithdrawalInfo(Vertical, CliveWidget):
"_content", "_content",
self._get_to_withdraw_hp, self._get_to_withdraw_hp,
id_="withdrawal-info-vests-amount", id_="withdrawal-info-vests-amount",
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
yield DynamicLabel( yield DynamicLabel(
self._provider, self._provider,
"_content", "_content",
self._get_to_withdraw_vests, self._get_to_withdraw_vests,
id_="withdrawal-info-hp-amount", id_="withdrawal-info-hp-amount",
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
def _get_next_withdrawal_date(self, content: HivePowerData) -> str: def _get_next_withdrawal_date(self, content: HivePowerData) -> str:
......
...@@ -3,6 +3,7 @@ from __future__ import annotations ...@@ -3,6 +3,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from clive.__private.core.formatters.humanize import humanize_vest_to_hive_ratio from clive.__private.core.formatters.humanize import humanize_vest_to_hive_ratio
from clive.__private.ui.not_updated_yet import is_updated
from clive.__private.ui.widgets.notice import Notice from clive.__private.ui.widgets.notice import Notice
if TYPE_CHECKING: if TYPE_CHECKING:
...@@ -16,7 +17,7 @@ class HpVestsFactor(Notice): ...@@ -16,7 +17,7 @@ class HpVestsFactor(Notice):
obj_to_watch=provider, obj_to_watch=provider,
attribute_name="_content", attribute_name="_content",
callback=self._get_hp_vests_factor, callback=self._get_hp_vests_factor,
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
def _get_hp_vests_factor(self, content: HivePowerData) -> str: def _get_hp_vests_factor(self, content: HivePowerData) -> str:
......
...@@ -6,6 +6,7 @@ from textual import on ...@@ -6,6 +6,7 @@ from textual import on
from textual.containers import Horizontal from textual.containers import Horizontal
from textual.widgets import Pretty, Static, TabPane from textual.widgets import Pretty, Static, TabPane
from clive.__private.core.commands.data_retrieval.hive_power_data import HivePowerData
from clive.__private.core.constants.tui.class_names import CLIVE_CHECKERBOARD_HEADER_CELL_CLASS_NAME from clive.__private.core.constants.tui.class_names import CLIVE_CHECKERBOARD_HEADER_CELL_CLASS_NAME
from clive.__private.core.ensure_vests import ensure_vests from clive.__private.core.ensure_vests import ensure_vests
from clive.__private.core.formatters.humanize import humanize_datetime, humanize_percent from clive.__private.core.formatters.humanize import humanize_datetime, humanize_percent
...@@ -15,7 +16,7 @@ from clive.__private.models.schemas import WithdrawVestingOperation ...@@ -15,7 +16,7 @@ from clive.__private.models.schemas import WithdrawVestingOperation
from clive.__private.ui.clive_widget import CliveWidget from clive.__private.ui.clive_widget import CliveWidget
from clive.__private.ui.data_providers.hive_power_data_provider import HivePowerDataProvider from clive.__private.ui.data_providers.hive_power_data_provider import HivePowerDataProvider
from clive.__private.ui.get_css import get_css_from_relative_path from clive.__private.ui.get_css import get_css_from_relative_path
from clive.__private.ui.not_updated_yet import NotUpdatedYet from clive.__private.ui.not_updated_yet import NotUpdatedYet, is_not_updated_yet
from clive.__private.ui.screens.operations.bindings.operation_action_bindings import OperationActionBindings from clive.__private.ui.screens.operations.bindings.operation_action_bindings import OperationActionBindings
from clive.__private.ui.screens.operations.operation_summary.cancel_power_down import CancelPowerDown from clive.__private.ui.screens.operations.operation_summary.cancel_power_down import CancelPowerDown
from clive.__private.ui.widgets.buttons import CancelOneLineButton, GenerousButton from clive.__private.ui.widgets.buttons import CancelOneLineButton, GenerousButton
...@@ -37,8 +38,6 @@ if TYPE_CHECKING: ...@@ -37,8 +38,6 @@ if TYPE_CHECKING:
from textual.app import ComposeResult from textual.app import ComposeResult
from clive.__private.core.commands.data_retrieval.hive_power_data import HivePowerData
class WithdrawRoutesDisplay(CliveWidget): class WithdrawRoutesDisplay(CliveWidget):
"""Widget used just to inform user to which account has withdrawal route and how much % it is.""" """Widget used just to inform user to which account has withdrawal route and how much % it is."""
...@@ -55,11 +54,13 @@ class WithdrawRoutesDisplay(CliveWidget): ...@@ -55,11 +54,13 @@ class WithdrawRoutesDisplay(CliveWidget):
def on_mount(self) -> None: def on_mount(self) -> None:
self.watch(self.provider, "_content", self._update_withdraw_routes) self.watch(self.provider, "_content", self._update_withdraw_routes)
def _update_withdraw_routes(self, content: HivePowerData | None) -> None: def _update_withdraw_routes(self, content: HivePowerData | NotUpdatedYet) -> None:
"""Update withdraw routes pretty widget.""" """Update withdraw routes pretty widget."""
if content is None: # data not received yet if is_not_updated_yet(content):
return return
assert isinstance(content, HivePowerData), "Content should be HivePowerData."
if not content.withdraw_routes: if not content.withdraw_routes:
self.query_exactly_one("#withdraw-routes-header", Static).update("You have no withdraw routes") self.query_exactly_one("#withdraw-routes-header", Static).update("You have no withdraw routes")
self._pretty.display = False self._pretty.display = False
......
...@@ -17,7 +17,7 @@ from clive.__private.models.schemas import ( ...@@ -17,7 +17,7 @@ from clive.__private.models.schemas import (
from clive.__private.ui.clive_widget import CliveWidget from clive.__private.ui.clive_widget import CliveWidget
from clive.__private.ui.data_providers.savings_data_provider import SavingsDataProvider from clive.__private.ui.data_providers.savings_data_provider import SavingsDataProvider
from clive.__private.ui.get_css import get_relative_css_path from clive.__private.ui.get_css import get_relative_css_path
from clive.__private.ui.not_updated_yet import NotUpdatedYet from clive.__private.ui.not_updated_yet import NotUpdatedYet, is_updated
from clive.__private.ui.screens.operation_base_screen import OperationBaseScreen from clive.__private.ui.screens.operation_base_screen import OperationBaseScreen
from clive.__private.ui.screens.operations.bindings import OperationActionBindings from clive.__private.ui.screens.operations.bindings import OperationActionBindings
from clive.__private.ui.screens.operations.operation_summary.cancel_transfer_from_savings import ( from clive.__private.ui.screens.operations.operation_summary.cancel_transfer_from_savings import (
...@@ -110,14 +110,14 @@ class SavingsInterestInfo(TrackedAccountReferencingWidget): ...@@ -110,14 +110,14 @@ class SavingsInterestInfo(TrackedAccountReferencingWidget):
"_content", "_content",
callback=self._get_unclaimed_hbd, callback=self._get_unclaimed_hbd,
classes="interest-info-row-even", classes="interest-info-row-even",
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
yield DynamicLabel( yield DynamicLabel(
self.provider, self.provider,
"_content", "_content",
callback=self._get_last_payment_date, callback=self._get_last_payment_date,
classes="interest-info-row-odd", classes="interest-info-row-odd",
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
def _get_last_payment_date(self, content: SavingsData) -> str: def _get_last_payment_date(self, content: SavingsData) -> str:
......
...@@ -4,6 +4,7 @@ from abc import abstractmethod ...@@ -4,6 +4,7 @@ from abc import abstractmethod
from typing import TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any
from clive.__private.abstract_class import AbstractClassMessagePump from clive.__private.abstract_class import AbstractClassMessagePump
from clive.__private.ui.not_updated_yet import is_updated
from clive.__private.ui.widgets.dynamic_widgets.dynamic_label import DynamicLabel from clive.__private.ui.widgets.dynamic_widgets.dynamic_label import DynamicLabel
if TYPE_CHECKING: if TYPE_CHECKING:
...@@ -27,7 +28,7 @@ class APR(DynamicLabel, AbstractClassMessagePump): ...@@ -27,7 +28,7 @@ class APR(DynamicLabel, AbstractClassMessagePump):
obj_to_watch=provider, obj_to_watch=provider,
attribute_name="_content", attribute_name="_content",
callback=self._get_apr, callback=self._get_apr,
first_try_callback=lambda content: content is not None, first_try_callback=is_updated,
) )
self._provider = provider self._provider = provider
......
...@@ -8,6 +8,7 @@ from textual.widgets import Static ...@@ -8,6 +8,7 @@ from textual.widgets import Static
from clive.__private.core.constants.tui.class_names import CLIVE_EVEN_COLUMN_CLASS_NAME, CLIVE_ODD_COLUMN_CLASS_NAME from clive.__private.core.constants.tui.class_names import CLIVE_EVEN_COLUMN_CLASS_NAME, CLIVE_ODD_COLUMN_CLASS_NAME
from clive.__private.ui.clive_widget import CliveWidget from clive.__private.ui.clive_widget import CliveWidget
from clive.__private.ui.not_updated_yet import NotUpdatedYet, is_not_updated_yet, is_updated
from clive.__private.ui.widgets.no_content_available import NoContentAvailable from clive.__private.ui.widgets.no_content_available import NoContentAvailable
from clive.__private.ui.widgets.section_title import SectionTitle from clive.__private.ui.widgets.section_title import SectionTitle
from clive.exceptions import CliveDeveloperError from clive.exceptions import CliveDeveloperError
...@@ -184,7 +185,7 @@ class CliveCheckerboardTable(CliveWidget): ...@@ -184,7 +185,7 @@ class CliveCheckerboardTable(CliveWidget):
if not self.should_be_dynamic: if not self.should_be_dynamic:
raise InvalidDynamicDefinedError raise InvalidDynamicDefinedError
if content is None: # data not received yet if is_not_updated_yet(content):
return return
if not self.check_if_should_be_updated(content): if not self.check_if_should_be_updated(content):
...@@ -193,13 +194,13 @@ class CliveCheckerboardTable(CliveWidget): ...@@ -193,13 +194,13 @@ class CliveCheckerboardTable(CliveWidget):
self.update_previous_state(content) self.update_previous_state(content)
await self.rebuild(content) await self.rebuild(content)
async def rebuild(self, content: ContentT | None = None) -> None: async def rebuild(self, content: ContentT | NotUpdatedYet | None = None) -> None:
"""Rebuilds whole table - explicit use available for static and dynamic version.""" """Rebuilds whole table - explicit use available for static and dynamic version."""
with self.app.batch_update(): with self.app.batch_update():
await self.query("*").remove() await self.query("*").remove()
await self.mount_all(self._create_table_content(content)) await self.mount_all(self._create_table_content(content))
async def rebuild_rows(self, content: ContentT | None = None) -> None: async def rebuild_rows(self, content: ContentT | NotUpdatedYet | None = None) -> None:
"""Rebuilds table rows - explicit use available for static and dynamic version.""" """Rebuilds table rows - explicit use available for static and dynamic version."""
with self.app.batch_update(): with self.app.batch_update():
await self.query(CliveCheckerboardTableRow).remove() await self.query(CliveCheckerboardTableRow).remove()
...@@ -207,8 +208,10 @@ class CliveCheckerboardTable(CliveWidget): ...@@ -207,8 +208,10 @@ class CliveCheckerboardTable(CliveWidget):
new_rows = self._create_table_rows(content) new_rows = self._create_table_rows(content)
await self.mount_all(new_rows) await self.mount_all(new_rows)
def _create_table_rows(self, content: ContentT | None = None) -> Sequence[CliveCheckerboardTableRow]: def _create_table_rows(
if content is not None and not self.is_anything_to_display(content): self, content: ContentT | NotUpdatedYet | None = None
) -> Sequence[CliveCheckerboardTableRow]:
if content is not None and is_updated(content) and not self.is_anything_to_display(content):
# if content is given, we can check if there is anything to display and return earlier # if content is given, we can check if there is anything to display and return earlier
return [] return []
...@@ -226,7 +229,7 @@ class CliveCheckerboardTable(CliveWidget): ...@@ -226,7 +229,7 @@ class CliveCheckerboardTable(CliveWidget):
self._set_evenness_styles(rows) self._set_evenness_styles(rows)
return rows return rows
def _create_table_content(self, content: ContentT | None = None) -> list[Widget]: def _create_table_content(self, content: ContentT | NotUpdatedYet | None = None) -> list[Widget]:
rows = self._create_table_rows(content) rows = self._create_table_rows(content)
if not rows: if not rows:
......
...@@ -7,6 +7,7 @@ from textual.widgets import Static ...@@ -7,6 +7,7 @@ from textual.widgets import Static
from clive.__private.ui.clive_widget import CliveWidget from clive.__private.ui.clive_widget import CliveWidget
from clive.__private.ui.data_providers.abc.data_provider import DataProvider from clive.__private.ui.data_providers.abc.data_provider import DataProvider
from clive.__private.ui.not_updated_yet import is_not_updated_yet
from clive.exceptions import CliveError from clive.exceptions import CliveError
if TYPE_CHECKING: if TYPE_CHECKING:
...@@ -77,9 +78,6 @@ class CliveDataTableRow(Horizontal, CliveWidget): ...@@ -77,9 +78,6 @@ class CliveDataTableRow(Horizontal, CliveWidget):
def refresh_row(self, content: Any) -> None: # noqa: ANN401 def refresh_row(self, content: Any) -> None: # noqa: ANN401
"""Iterate through the cells and update each of them.""" """Iterate through the cells and update each of them."""
if content is None: # data not received yet
return
for cell, value in zip(self.cells, self.get_new_values(content), strict=True): for cell, value in zip(self.cells, self.get_new_values(content), strict=True):
cell.update(value) cell.update(value)
...@@ -133,7 +131,7 @@ class CliveDataTable(CliveWidget): ...@@ -133,7 +131,7 @@ class CliveDataTable(CliveWidget):
self.watch(self.provider, "_content", self.refresh_rows) self.watch(self.provider, "_content", self.refresh_rows)
def refresh_rows(self, content: Any) -> None: # noqa: ANN401 def refresh_rows(self, content: Any) -> None: # noqa: ANN401
if content is None: # data not received yet if is_not_updated_yet(content):
return return
with self.app.batch_update(): with self.app.batch_update():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment