Skip to content

Commit 097bbc0

Browse files
committed
Rename pathname to path
1 parent 130bc00 commit 097bbc0

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

docs/source/about/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Unreleased
2929
- :pull:`1256` - Change ``set_state`` comparison method to check equality with ``==`` more consistently.
3030
- :pull:`1257` - Add support for rendering ``@component`` children within ``vdom_to_html``.
3131
- :pull:`1113` - Renamed the ``use_location`` hook's ``search`` attribute to ``query_string``.
32+
- :pull:`1113` - Renamed the ``use_location`` hook's ``pathname`` attribute to ``path``.
3233
- :pull:`1113` - Renamed ``reatpy.config.REACTPY_DEBUG_MODE`` to ``reactpy.config.REACTPY_DEBUG``.
3334

3435
**Removed**

src/reactpy/asgi/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async def run_dispatcher(
172172
connection = Connection(
173173
scope=scope,
174174
location=Location(
175-
pathname=ws_query_string.get("http_pathname", [""])[0],
175+
path=ws_query_string.get("http_pathname", [""])[0],
176176
query_string=ws_query_string.get("http_search", [""])[0],
177177
),
178178
carrier=self,

src/reactpy/core/types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ class Location:
277277
``document.location`` object.
278278
"""
279279

280-
pathname: str
281-
"""the path of the URL for the location"""
280+
path: str
281+
"""The URL's path segment. This typically represents the current
282+
HTTP request's path."""
282283

283284
query_string: str
284285
"""HTTP query string - a '?' followed by the parameters of the URL.

tests/test_backend/test_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def ShowRoute():
124124
Location("/another/something/file.txt", "?key=value"),
125125
Location("/another/something/file.txt", "?key1=value1&key2=value2"),
126126
]:
127-
await display.goto(loc.pathname + loc.query_string)
127+
await display.goto(loc.path + loc.query_string)
128128
await poll_location.until_equals(loc)
129129

130130

0 commit comments

Comments
 (0)