Skip to content

feat: persist route query to local #1920

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

Merged
merged 3 commits into from
Jul 31, 2020
Merged

Conversation

fxxjdedd
Copy link
Contributor

Provide a way for the shell script running in the docker container to get the url query.

Provide a way for the shell script running in the docker container to get the url query.
@code-asher
Copy link
Member

Thanks for the contribution! Could you expound on the use case?

@fxxjdedd
Copy link
Contributor Author

fxxjdedd commented Jul 29, 2020

Thank you for your reply.
The use case is: the URL of our web ide will carry some dynamic parameters, such as user, project, cluster, etc. These parameters need to be obtained in the debugger and terminal.

I did not find a solution to the problem, so I think this may be a new feature.

@code-asher
Copy link
Member

code-asher commented Jul 29, 2020

Interesting, thanks for the additional details. We already have a file that contains the last visited path in ~/.local/share/code-server/coder.json (just a bit further down in getRoot). Would it work for your use case to add the query variables as JSON to that file instead?

@fxxjdedd
Copy link
Contributor Author

fxxjdedd commented Jul 29, 2020 via email

@code-asher
Copy link
Member

Awesome, let's go that route then.

I added a shallow parameter, because the query should not be extends, but should be replaced directly.
@fxxjdedd
Copy link
Contributor Author

@code-asher

I made some changes and it works fine locally.

@fxxjdedd
Copy link
Contributor Author

fxxjdedd commented Jul 30, 2020 via email

@code-asher
Copy link
Member

That's fair, let's leave out the await.

We can pass true when updating both to use the shallow update. That's actually preferable anyway because the lastVisited object should be replaced entirely.

@code-asher
Copy link
Member

In fact I'm thinking about removing extends entirely because I'm not sure we even need a recursive merge.

@fxxjdedd
Copy link
Contributor Author

fxxjdedd commented Jul 30, 2020 via email

In addition, the `settings.write` method now uses shallow merge by default
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks for the contribution!

@code-asher code-asher merged commit cbf7c95 into coder:master Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants