-
Notifications
You must be signed in to change notification settings - Fork 760
fix: include all query params in WebSocket connection #5507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: include all query params in WebSocket connection #5507
Conversation
The frontend was only passing the session_id query parameter to the WebSocket connection, ignoring all other query parameters from the current page URL. This fix modifies getWsURL() and getWsSyncURL() to merge the current page's query parameters with the base URL parameters before establishing the WebSocket connection. Fixes the issue where mo.query_params() would only return the first parameter when multiple query parameters were present in the URL.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
for more information, see https://pre-commit.ci
|
Not sure why the vercel test is failing, and I don't have access to investigate further. Seems like this is failing for other PRs as well, so I suspect it's upstream of this change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.14.10-dev13 |
Run `uv run scripts/generate_bash_focus.py <since-tag>` to print a list of all PRs labeled with `bash-focus`. Example output: ``` Using latest tag: 0.14.9 Fetching PRs with label 'bash-focus' since 0.14.9... Found 4 PR(s) with label 'bash-focus': #5515: fix: reuse ports that are available but recently closed Author: @akshayka Link: #5515 Merged: 2025-07-02T15:52:50Z #5507: fix: include all query params in WebSocket connection Author: @harterrt-shopify Link: #5507 Merged: 2025-07-01T17:41:15Z #5491: Ensure cell action tooltip appears above sidebar panel Author: @manzt Link: #5491 Merged: 2025-06-30T18:09:19Z #5474: register UIElement on change if it is missing from the UIElementRegistry Author: @buckley-w-david Link: #5474 Merged: 2025-06-30T15:56:00Z ``` --------- Co-authored-by: Trevor Manz <trevor.j.manz@gmail.com>
# Fix: Include all query params in WebSocket connection
## Summary
- Fixed an issue where `mo.query_params()` was only returning `file`
query parameters
- The frontend now passes all query parameters from the browser URL to
the WebSocket connection
- Previously, only special parameters like `session_id` and `file` were
being passed through
## What this PR does
When visiting a marimo notebook with multiple query parameters like:
```
http://localhost:2718/?file=test.py&search=test&other=last
```
Previously, `mo.query_params()` would only return:
```python
{"file": "test.py"}
```
Now it correctly returns all parameters:
```python
{
"file": "test.py",
"search": "test",
"other": "last"
}
```
## How to test
1. Create a simple test notebook:
```python
import marimo as mo
@app.cell
def _(mo):
params = mo.query_params()
params
```
2. Run the notebook and open with query parameters:
```
http://localhost:2718/?file=test.py&search=test&other=last
```
3. Verify that all three parameters are displayed
## 📋 Checklist
- [x] I have read the [contributor
guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md).
- [x] For large changes, or changes that affect the public API: this
change was discussed or approved through an issue, on
[Discord](https://marimo.io/discord?ref=pr), or the community
[discussions](https://github.com/marimo-team/marimo/discussions) (Please
provide a link if applicable). - this is a bugfix.
- [x] I have added tests for the changes made.
- [x] I have run the code and verified that it works as expected.
## 📜 Reviewers
@mscolnick - this is a bugfix for the frontend.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Run `uv run scripts/generate_bash_focus.py <since-tag>` to print a list of all PRs labeled with `bash-focus`. Example output: ``` Using latest tag: 0.14.9 Fetching PRs with label 'bash-focus' since 0.14.9... Found 4 PR(s) with label 'bash-focus': marimo-team#5515: fix: reuse ports that are available but recently closed Author: @akshayka Link: marimo-team#5515 Merged: 2025-07-02T15:52:50Z marimo-team#5507: fix: include all query params in WebSocket connection Author: @harterrt-shopify Link: marimo-team#5507 Merged: 2025-07-01T17:41:15Z marimo-team#5491: Ensure cell action tooltip appears above sidebar panel Author: @manzt Link: marimo-team#5491 Merged: 2025-06-30T18:09:19Z marimo-team#5474: register UIElement on change if it is missing from the UIElementRegistry Author: @buckley-w-david Link: marimo-team#5474 Merged: 2025-06-30T15:56:00Z ``` --------- Co-authored-by: Trevor Manz <trevor.j.manz@gmail.com>
Fix: Include all query params in WebSocket connection
Summary
mo.query_params()was only returningfilequery parameterssession_idandfilewere being passed throughWhat this PR does
When visiting a marimo notebook with multiple query parameters like:
Previously,
mo.query_params()would only return:{"file": "test.py"}Now it correctly returns all parameters:
{ "file": "test.py", "search": "test", "other": "last" }How to test
📋 Checklist
📜 Reviewers
@mscolnick - this is a bugfix for the frontend.