Skip to content

Commit a6d3149

Browse files
committed
Clean up TODOs
1 parent 8be292d commit a6d3149

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

shiny/bookmark/_bookmark.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383

8484
class Bookmark(ABC):
8585

86-
# TODO: Barret - This feels like it needs to be a weakref
8786
_session_root: Session
8887
"""
8988
The root session object (most likely a `AppSession` object).
@@ -145,7 +144,6 @@ def __init__(self, session_root: Session):
145144
# from ._restore_state import RestoreContext
146145

147146
super().__init__()
148-
# TODO: Barret - Q: Should this be a weakref; Session -> Bookmark -> Session
149147
self._session_root = session_root
150148
self._restore_context_value = None
151149
self._store = MISSING
@@ -248,7 +246,6 @@ async def update_query_string(
248246
...
249247

250248
@abstractmethod
251-
# TODO: Barret - Q: Rename to `update()`? `session.bookmark.update()`?
252249
async def do_bookmark(self) -> None:
253250
"""
254251
Perform bookmarking.
@@ -521,7 +518,6 @@ def __init__(self, session_proxy: SessionProxy):
521518
super().__init__(session_proxy.root_scope())
522519

523520
self._ns = session_proxy.ns
524-
# TODO: Barret - Q: Should this be a weakref
525521
self._session_proxy = session_proxy
526522

527523
self._session_root.bookmark._proxy_exclude_fns.append(
@@ -625,11 +621,8 @@ def on_bookmarked(
625621
self,
626622
callback: Callable[[str], None] | Callable[[str], Awaitable[None]],
627623
/,
628-
) -> NoReturn:
629-
# TODO: Barret - Q: Shouldn't we implement this? `self._root_bookmark.on_bookmark()`
630-
raise NotImplementedError(
631-
"Please call `.on_bookmarked()` from the root session only, e.g. `session.root_scope().bookmark.on_bookmark()`."
632-
)
624+
) -> CancelCallback:
625+
return self._on_bookmarked_callbacks.register(wrap_async(callback))
633626

634627
def _get_bookmark_exclude(self) -> NoReturn:
635628
raise NotImplementedError(

shiny/bookmark/_external.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
bound=Callable[[str], Awaitable[Path]] | Callable[[str], Awaitable[Path]],
3838
)
3939

40+
# TODO: Barret - Integrate Set / Restore for Connect. Ex: Connect https://github.com/posit-dev/connect/blob/8de330aec6a61cf21e160b5081d08a1d3d7e8129/R/connect.R#L915
41+
4042

4143
def set_save_dir(fn: GetBookmarkDirT) -> GetBookmarkDirT:
4244
"""TODO: Barret document"""

shiny/bookmark/_restore_state.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _state_within_namespace(self, prefix: str) -> "RestoreState":
5959
if self._name_has_namespace(name, prefix)
6060
}
6161

62-
# TODO: Barret; Is this for bookmarking?!?
62+
# TODO: Barret; Is this for file inputs?!?
6363
dir = self.dir
6464
if dir is not None:
6565
dir = dir / prefix
@@ -194,7 +194,6 @@ async def _load_state_qs(self, query_string: str) -> None:
194194

195195
if load_bookmark_fn is None:
196196
if is_hosted():
197-
# TODO: Barret; Implement Connect's `bookmark_load_dir` function
198197
raise NotImplementedError(
199198
"The hosting environment does not support server-side bookmarking."
200199
)

shiny/bookmark/_save_state.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
from ._types import GetBookmarkSaveDir
1414
from ._utils import is_hosted, to_json_str
1515

16-
# TODO: Barret - Set / Load SaveState for Connect. Ex: Connect https://github.com/posit-dev/connect/blob/8de330aec6a61cf21e160b5081d08a1d3d7e8129/R/connect.R#L915
17-
# Might need to have independent save/load functions to register to avoid a class constructor
18-
19-
2016
if TYPE_CHECKING:
2117
from .. import Inputs
2218
else:

0 commit comments

Comments
 (0)