Skip to content

Sync url and params tab #166

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

Open
CH1NRU5T opened this issue Feb 23, 2024 · 13 comments
Open

Sync url and params tab #166

CH1NRU5T opened this issue Feb 23, 2024 · 13 comments
Labels
good first issue Good for newcomers

Comments

@CH1NRU5T
Copy link
Contributor

Describe the bug/problem
Syncing of url and params tab

Steps to Reproduce the bug/problem

  1. After opening the app, paste https://api.foss42.com/country/data?code=US in the url field
    Screenshot 2024-02-23 at 7 05 41 PM

Expected behavior

  1. If we paste a url which has parameters in it, it should be synced with params tab
    Screenshot 2024-02-23 at 7 06 35 PM
  2. If we add params in the params tab, they should get added in the url.

Device Info (The device where you encountered this issue):

  • OS: MacOS
  • Version: Sonoma 14.3.1
@CH1NRU5T CH1NRU5T added the bug Something isn't working label Feb 23, 2024
@animator
Copy link
Member

Yes this syncup should be added to API Dash

@animator animator added enhancement New feature or request and removed bug Something isn't working labels Feb 24, 2024
@YoussefMoRabie
Copy link
Contributor

@animator I would like to work on this.
Can you assign it to me?

@animator animator added the good first issue Good for newcomers label Feb 25, 2024
@mohnishdeshpande
Copy link

@animator I reckon I have figured out a way to fix this. Will finish the implementation and submit a PR after testing.

@ashitaprasad
Copy link
Member

@Yousef-Rabia We do not assign issues. You are free to work on it and send across a PR.

@ashitaprasad
Copy link
Member

Sure @mohnishdeshpande.

@mohnishdeshpande
Copy link

@ashitaprasad Please see the 'Note' in the PR description regarding 'kNameValueEmptyModel'. Cheers!

@ashitaprasad
Copy link
Member

We had a thorough discussion regarding the approach. And we want to focus on user experience and keep it easy to use for the end user who should be able to view/edit the API endpoint without any difficulty. Adding URL parameters in the URL field hampers the readability and makes editing difficult.
Proposed solution:

  • Have a separate URL preview section under the URL card (simple text with small font size with copy button) which shows the final url including all the query parameters. Users should be able to turn it off via Settings. Any query params entered in the row will automatically update the URL preview.
  • Now, coming to the point - what happens when a user pastes a url with query params or adds a query param in the url field. It should automatically get removed and should get added as a row(s) in the URL parameter section. Note, the URL previewer will show the the full URL including the query params.

cc: @mohnishdeshpande @amankumarmahavar @Tanish2002

@badnikhil
Copy link
Contributor

badnikhil commented Mar 15, 2025

@ashitaprasad Working on this, but I have a few doubts:

If a user pastes a URL with a parameter that already exists separately, should it be overridden or kept as is?

Example: If name=nikhil exists and the user pastes www.example.com?name=varun, should name=varun replace it or stay name=nikhil?

In addition to it , decoding query parameters can be complicated due to special characters, duplicate keys etc. Need a lot of thinking on how to handle these cases.I think Uri can do this need to check...

@animator
Copy link
Member

@ashitaprasad Working on this, but I have a few doubts:

If a user pastes a URL with a parameter that already exists separately, should it be overridden or kept as is?

Example: If name=nikhil exists and the user pastes www.example.com?name=varun, should name=varun replace it or stay name=nikhil?

In addition to it , decoding query parameters can be complicated due to special characters, duplicate keys etc. Need a lot of thinking on how to handle these cases.I think Uri can do this need to check...

@badnikhil good question. The answer to this question lies in resolving issue #268

@badnikhil
Copy link
Contributor

@animator I might not have explained my question well, but you shared something useful. Thanks!
My takeaway— all parameters, whether unique or not, should be included in the final URL .

@badnikhil
Copy link
Contributor

badnikhil commented Mar 16, 2025

@ashitaprasad Working on this, but I have a few doubts:
If a user pastes a URL with a parameter that already exists separately, should it be overridden or kept as is?
Example: If name=nikhil exists and the user pastes www.example.com?name=varun, should name=varun replace it or stay name=nikhil?
In addition to it , decoding query parameters can be complicated due to special characters, duplicate keys etc. Need a lot of thinking on how to handle these cases.I think Uri can do this need to check...

@badnikhil good question. The answer to this question lies in resolving issue #268

@animator The PR solving #268 was closed because it required a lot of changes in the code. How should I proceed with this issue now to ensure all edge cases are handled? or i should ignore this case (multiple params with same name) .. just for now

@animator
Copy link
Member

@ashitaprasad Working on this, but I have a few doubts:
If a user pastes a URL with a parameter that already exists separately, should it be overridden or kept as is?
Example: If name=nikhil exists and the user pastes www.example.com?name=varun, should name=varun replace it or stay name=nikhil?
In addition to it , decoding query parameters can be complicated due to special characters, duplicate keys etc. Need a lot of thinking on how to handle these cases.I think Uri can do this need to check...

@badnikhil good question. The answer to this question lies in resolving issue #268

@animator The PR solving #268 was closed because it required a lot of changes in the code. How should I proceed with this issue now to ensure all edge cases are handled? or i should ignore this case (multiple params with same name) .. just for now

The PR was closed at that time because the repo was undergoing lot of structural changes. Now that the core is stable this issue can be attempted again.

@badnikhil
Copy link
Contributor

@animator The PR solving #268 was closed because it required a lot of changes in the code. How should I proceed with this issue now to ensure all edge cases are handled? or i should ignore this case (multiple params with same name) .. just for now

The PR was closed at that time because the repo was undergoing lot of structural changes. Now that the core is stable this issue can be attempted again.

Working on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment