Skip to content

Commit 200d0fb

Browse files
committed
cleanup plan
1 parent 6b413af commit 200d0fb

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

plans/DH-21898-routing-part-two.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class WidgetPath:
5151
local: str | None = None
5252
```
5353

54-
| Field | Type | Default | Description |
55-
| -------- | -------------- | ------- | ------------------------------------------------------------------------------------------------- |
56-
| `widget` | `str` || The widget name |
57-
| `embed` | `bool` | `False` | Use embed route (`True`) or app route (`False`). |
58-
| `local` | `str \| None` | `None` | User-defined sub-path, query params, and fragment appended after `/local/`. Leading `/` optional. |
54+
| Field | Type | Default | Description |
55+
| -------- | ------------- | ------- | ------------------------------------------------------------------------------------------------- |
56+
| `widget` | `str` || The widget name |
57+
| `embed` | `bool` | `False` | Use embed route (`True`) or app route (`False`). |
58+
| `local` | `str \| None` | `None` | User-defined sub-path, query params, and fragment appended after `/local/`. Leading `/` optional. |
5959

6060
### `EnterpriseWidgetPath`
6161

@@ -87,13 +87,13 @@ class EnterpriseWidgetPath:
8787
replica_slot: int | None = None
8888
```
8989

90-
| Field | Type | Default | Description |
91-
| -------------- | -------------- | ------- | ------------------------------------------------------------------------------------------------- |
92-
| `widget` | `str` || The widget name |
93-
| `query` | `str \| int` || The persistent query name or serial number (required) |
94-
| `embed` | `bool` | `False` | Use embed route (`True`) or app/dashboard route (`False`). |
95-
| `local` | `str \| None` | `None` | User-defined sub-path, query params, and fragment appended after `/local/`. Leading `/` optional. |
96-
| `replica_slot` | `int \| None` | `None` | Optional replica slot number for the widget route. |
90+
| Field | Type | Default | Description |
91+
| -------------- | ------------- | ------- | ------------------------------------------------------------------------------------------------- |
92+
| `widget` | `str` || The widget name |
93+
| `query` | `str \| int` || The persistent query name or serial number (required) |
94+
| `embed` | `bool` | `False` | Use embed route (`True`) or app/dashboard route (`False`). |
95+
| `local` | `str \| None` | `None` | User-defined sub-path, query params, and fragment appended after `/local/`. Leading `/` optional. |
96+
| `replica_slot` | `int \| None` | `None` | Optional replica slot number for the widget route. |
9797

9898
### `RoutePath`
9999

@@ -894,10 +894,10 @@ All routing logic is pure Python. No frontend changes needed. The router reads U
894894
- Wildcard routes (`*`) have the lowest priority among siblings.
895895
- Optional segments are matched greedily (present match preferred over absent).
896896
- Index routes match only the exact parent path.
897-
7. **Param extraction**: on match, extract `{var_name}` values from the URL segments into a `dict[str, str]`.
898-
8. **Rendering**: wrap the matched element using the existing `Context` callable: `_route_params_context(matched_element(), value=params)`. This pushes the params onto the context stack so `use_params()` can read them.
899-
9. **Not found**: if no route matches, render an error element indicating the path was not found.
900-
10. **Export** `router` from `components/__init__.py`.
897+
6. **Param extraction**: on match, extract `{var_name}` values from the URL segments into a `dict[str, str]`.
898+
7. **Rendering**: wrap the matched element using the existing `Context` callable: `_route_params_context(matched_element(), value=params)`. This pushes the params onto the context stack so `use_params()` can read them.
899+
8. **Not found**: if no route matches, render an error element indicating the path was not found.
900+
9. **Export** `router` from `components/__init__.py`.
901901

902902
#### `use_params`
903903

@@ -942,8 +942,8 @@ No frontend changes needed — routing logic is entirely in the Python backend.
942942
- If `local_path` is provided, strip any leading `/` and append `/local/{local_path}`.
943943
- Include `replica_slot` in the embed path if provided (`{base_url}/iriside/embed/widget/{query}/{widget}/{replica_slot}`).
944944

945-
4. **Create `hooks/use_widget_path.py`** that calls `get_context().get_base_url()` to get the base URL, then delegates to `resolve_widget_path(widget_path, base_url)` and returns the resolved string.
946-
5. **Export** `WidgetPath` and `EnterpriseWidgetPath` from `types/__init__.py` and from the top-level `deephaven.ui` namespace. Export `use_widget_path` from `hooks/__init__.py`.
945+
3. **Create `hooks/use_widget_path.py`** that calls `get_context().get_base_url()` to get the base URL, then delegates to `resolve_widget_path(widget_path, base_url)` and returns the resolved string.
946+
4. **Export** `WidgetPath` and `EnterpriseWidgetPath` from `types/__init__.py` and from the top-level `deephaven.ui` namespace. Export `use_widget_path` from `hooks/__init__.py`.
947947

948948
### Frontend (TypeScript)
949949

@@ -959,16 +959,16 @@ No frontend changes needed — routing logic is entirely in the Python backend.
959959

960960
### New Files
961961

962-
| File | Description |
963-
| ----------------------------- | ------------------------------------------------------------------------ |
964-
| `hooks/use_path.py` | Path hook |
965-
| `hooks/use_navigate.py` | Navigate hook |
966-
| `hooks/use_url_components.py` | URL components hook |
967-
| `hooks/use_params.py` | Route params hook (via context) |
968-
| `hooks/use_widget_path.py` | Resolves `WidgetPath`/`EnterpriseWidgetPath` to a string |
969-
| `types/widget_path.py` | `WidgetPath` and `EnterpriseWidgetPath` frozen dataclasses |
970-
| `components/route.py` | `_Route` dataclass, `RoutePath` type alias, and `route()` factory |
971-
| `components/router.py` | `router` component with widget path resolution |
962+
| File | Description |
963+
| ----------------------------- | ----------------------------------------------------------------- |
964+
| `hooks/use_path.py` | Path hook |
965+
| `hooks/use_navigate.py` | Navigate hook |
966+
| `hooks/use_url_components.py` | URL components hook |
967+
| `hooks/use_params.py` | Route params hook (via context) |
968+
| `hooks/use_widget_path.py` | Resolves `WidgetPath`/`EnterpriseWidgetPath` to a string |
969+
| `types/widget_path.py` | `WidgetPath` and `EnterpriseWidgetPath` frozen dataclasses |
970+
| `components/route.py` | `_Route` dataclass, `RoutePath` type alias, and `route()` factory |
971+
| `components/router.py` | `router` component with widget path resolution |
972972

973973
### Modified Files
974974

0 commit comments

Comments
 (0)