-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[RFC] [reference] Introduce Query Params #1579
base: main
Are you sure you want to change the base?
Conversation
); | ||
|
||
React.useEffect(() => { | ||
updateQueryStringURL(state.queryStringParams); |
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.
instead of doing the parsing here, the parsing should happen in the reducer. just to keep all the processing happening in one place, on a per-action basis
c40b524
to
3d2fdfe
Compare
Also, @acao looks like |
@harshithpabbati fixed! this was supposed to be changed programatically in netlify.toml but it didn't seem to work. should be good now! |
0b790ea
to
eda6d26
Compare
@@ -89,6 +92,7 @@ export function VariableEditor(props: VariableEditorProps) { | |||
if (!ignoreChangeEvent) { | |||
cachedValueRef.current = editor.getValue(); | |||
session.changeVariables(cachedValueRef.current); | |||
browser.changeQueryStringParams('variables', cachedValueRef.current); |
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.
exactly what i was hoping for! excellent work @harshithpabbati !
4fa9ca3
to
1c11938
Compare
@harshithpabbati idea: make this a utility in |
sure, will do 👍 |
eda6d26
to
93b618e
Compare
|
93b618e
to
3662456
Compare
Codecov Report
@@ Coverage Diff @@
## main #1579 +/- ##
=======================================
Coverage 65.66% 65.66%
=======================================
Files 85 85
Lines 5115 5115
Branches 1624 1624
=======================================
Hits 3359 3359
Misses 1752 1752
Partials 4 4 Continue to review full report at Codecov.
|
@harshithpabbati thanks for implementing this in the RFC as well! |
3662456
to
ef36640
Compare
* Migrated codemirror-graphql to typescript * Migrated codemirror-graphql tests to typescript * Cleaned up codemirror-graphql package.json set build output to root (to align with current behavior) * ignore generated __tests__ folder from eslint * Updated codemirror typing * Updated codemirror typing * Updated ci-e2e script * Exclude babel and jest config from npm files
Co-authored-by: Samuel <samuelimolo4real@gmail.com> Co-authored-by: Rikki <rikki.schulte@gmail.com>
variables: parseQueryStringURL(window.location.search).variables, | ||
operationName: parseQueryStringURL(window.location.search).operationName, | ||
}, | ||
queryStringParamsURL: '', |
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.
I'm not sure I understand why we need to have both queryStringParams
and queryStringParamsURL
. If I understand it correctly, they both contain the same data, just formatted differently.
@@ -89,6 +92,7 @@ export function VariableEditor(props: VariableEditorProps) { | |||
if (!ignoreChangeEvent) { | |||
cachedValueRef.current = editor.getValue(); | |||
session.changeVariables(cachedValueRef.current); | |||
browser.changeQueryStringParams('variables', cachedValueRef.current); |
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.
@acao question: should the browser
context util be separated from the session
context util? From what I can see, we seem to also be setting session
whenever we are changing the query string. So perhaps the session
context util can simply update the browser context as well? Or is there another reason why we have them separate that I'm not aware of?
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.
Session here refers to the current tab, incidentally haha. Maybe EditorSession would be more explicit?
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.
either way, all of this will be replaced. excellent points to consider in the next state management iteration.
@thomasheyenbrock @jonathanawesome I think this one is really important to address in 2.0.0! Users have long requested a configurable and safe way to handle query params, but most in their implementations are left up to them. The expectation of |
This PR introduces Query Params
Todo