Skip to content
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

Add user facing setting for persisting headers #2895

Conversation

TheMightyPenguin
Copy link
Contributor

@TheMightyPenguin TheMightyPenguin commented Nov 11, 2022

Resolves #2793

Description

Adds a user control in the settings dialog for persisting headers. This is only visible if the shouldPersistHeaders is explicitly set as false.

Demo and brief explanation: https://www.loom.com/share/d72cf65025b04b1f9d6d5e518445bc25

image

I also found 2 potential issues when working on this:

Note for the future: I think it would be nice to somehow refactor this out into a user settings module, not the UI but the logic to store and access user settings. At the moment we have Theme and now Persist Headers, but there could be more user controlled settings going forward and having a central place for this logic (including defaults and such) could be nice.

Questions

  1. As headers are not persisted as a security measure, should we include a warning for the user in the dialog?
  2. I added logic to cleanup the headers storage if this option is turned off, do we also need to do the same for tabs state?

@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2022

🦋 Changeset detected

Latest commit: 223ab74

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
graphiql Minor
@graphiql/react Minor
@graphiql/plugin-explorer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@TheMightyPenguin TheMightyPenguin force-pushed the user-facing-setting-persist-headers branch 4 times, most recently from ebfc204 to 60f0180 Compare November 11, 2022 21:43
@acao
Copy link
Member

acao commented Nov 12, 2022

thank you so much for this @TheMightyPenguin !

@acao
Copy link
Member

acao commented Nov 12, 2022

should we include a warning for the user in the dialog?

I think so, perhaps just a warning to make sure they trust the device they are persisting these secrets to.

do we also need to do the same for tabs state?

it would be lovely if you could cover that case as well!

@acao
Copy link
Member

acao commented Nov 13, 2022

@TheMightyPenguin merged an upstream PR where @jonathanawesome fixed the act() issue, sorry for the merge conflicts!

@acao
Copy link
Member

acao commented Nov 13, 2022

This is only visible if the shouldPersistHeaders is not passed to the GraphQL component.

this seems sensible! what do you think of this?

  • if shouldPersistHeaders isfalse explicitly, we should not show the setting
  • otherwise, if it is true or not specified, the user defined setting is available, defaulting to enabled/disabled respectively

@TheMightyPenguin
Copy link
Contributor Author

This is only visible if the shouldPersistHeaders is not passed to the GraphQL component.

this seems sensible! what do you think of this?

  • if shouldPersistHeaders isfalse explicitly, we should not show the setting
  • otherwise, if it is true or not specified, the user defined setting is available, defaulting to enabled/disabled respectively

I like it, seems considerate with the end user being in control of their privacy, I'll include this logic in the next commit!

@TheMightyPenguin
Copy link
Contributor Author

TheMightyPenguin commented Nov 18, 2022

@acao updated PR, now we only show the setting if the property is not set (undefined) or true.

When toggling the option off, we clean up the tabs storage, removing any headers key in there, I added tests for this logic. When toggling it back on, it will also re-store the headers in the storage as well, so you can toggle off/on, then reload the page and all of the headers should still be there 😄.

I also added a warning message (using the warning color, let me know is the styling is not right 😅):
image

And recorded a new demo showing these: https://www.loom.com/share/d72cf65025b04b1f9d6d5e518445bc25

@TheMightyPenguin TheMightyPenguin force-pushed the user-facing-setting-persist-headers branch from 60f0180 to 1f18051 Compare November 18, 2022 21:46
Copy link
Collaborator

@thomasheyenbrock thomasheyenbrock left a 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 if we should add the state for user-controlling this setting to the EditorContextProvider. I feel that this is more of a thing that should happen in user-land (from the perspective of @graphiql/react).

To give an example: If I'm building my own custom GraphQL IDE with the components from @graphiql/react, I might have a clear opinion on how I want to persist headers or not. I already have the shouldPersistHeaders prop that I can use to control this behavior. Changing this state with the setShouldPersistHeaders method added in this PR gives me too much control that I don't need.

My proposal here is to move the state for the new toggle button in the settings dialog to the GraphiQL component. This component can combine this state with the value it receives as shouldPersistHeaders prop and pass the "final" value for that prop to the GraphiQLProvider. It also passes the value and the state-setter down to the GraphiQLInterface component which will use it to render the toggle button in the settings dialog. That way we don't need to expose any more state or methods from the EditorContext which keep it more easy to use.

Finally: Having a chunk of logic in the EditorContextProvider that clears the persisted header state when the shouldPersistHeaders prop changes is a fantastic addition, so we should definitely leave that in! (In fact, I would even consider it a bug that we're not doing it yet.)

.changeset/sweet-foxes-drive.md Outdated Show resolved Hide resolved
@TheMightyPenguin TheMightyPenguin force-pushed the user-facing-setting-persist-headers branch from b9e61bd to 2663e49 Compare November 25, 2022 21:50
@TheMightyPenguin
Copy link
Contributor Author

TheMightyPenguin commented Nov 25, 2022

I'm not sure if we should add the state for user-controlling this setting to the EditorContextProvider. I feel that this is more of a thing that should happen in user-land (from the perspective of @graphiql/react).

To give an example: If I'm building my own custom GraphQL IDE with the components from @graphiql/react, I might have a clear opinion on how I want to persist headers or not. I already have the shouldPersistHeaders prop that I can use to control this behavior. Changing this state with the setShouldPersistHeaders method added in this PR gives me too much control that I don't need.

My proposal here is to move the state for the new toggle button in the settings dialog to the GraphiQL component. This component can combine this state with the value it receives as shouldPersistHeaders prop and pass the "final" value for that prop to the GraphiQLProvider. It also passes the value and the state-setter down to the GraphiQLInterface component which will use it to render the toggle button in the settings dialog. That way we don't need to expose any more state or methods from the EditorContext which keep it more easy to use.

Finally: Having a chunk of logic in the EditorContextProvider that clears the persisted header state when the shouldPersistHeaders prop changes is a fantastic addition, so we should definitely leave that in! (In fact, I would even consider it a bug that we're not doing it yet.)

@thomasheyenbrock I tried implementing this, but there's an issue as the GraphiQL would not have access to the storage context for getting the initial value. We could make this work somehow but not sure how clean the solution would be 😅. Gonna think this one a bit more to see what workaround we could use.

Additionally, I'd say we could always show the setting in the GraphiQL component, as long as there is a valid storage defined (storageContext.storage !== null) as otherwise this setting won't do anything, removing the logic we have for showing this in only certain scenarios (e.g. when the prop is true or undefined) would simplify the code.

@acao acao added the potential plugin A potential plugin idea for later versions of GraphiQL label Nov 26, 2022
@TheMightyPenguin
Copy link
Contributor Author

@acao @thomasheyenbrock pushed a few commits addressing the comments!

Copy link
Member

@acao acao left a comment

Choose a reason for hiding this comment

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

Everything looks in order to me, and I concur with your choice to make the option always available!

@acao acao dismissed thomasheyenbrock’s stale review December 6, 2022 00:59

the review items were addressed

@jonathanawesome
Copy link
Collaborator

Looks good to me, thanks @TheMightyPenguin for the thorough PR!

@TheMightyPenguin
Copy link
Contributor Author

@acao @thomasheyenbrock @jonathanawesome anything missing from my side in this PR? (just making sure I am not blocking anything)

Copy link
Collaborator

@thomasheyenbrock thomasheyenbrock left a comment

Choose a reason for hiding this comment

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

Awesome, this looks fine for me 💯

@thomasheyenbrock thomasheyenbrock merged commit ccba2f3 into graphql:main Jan 9, 2023
@acao acao mentioned this pull request Jan 9, 2023
@TheMightyPenguin TheMightyPenguin deleted the user-facing-setting-persist-headers branch January 9, 2023 19:06
JohnAdamsy added a commit to JohnAdamsy/graphiql that referenced this pull request Jul 12, 2023
* Fix react testling library context errors (graphql#2903)

* upgrades testing-library packages to latest allowed @ React 17
* updates @graphiql/react test files for new testing-library version
* updates tests to remove act() warnings
• rewrites some tests to remove old prop values and use new ones

* fix autocomplete popover styles (graphql#2910)

* fix styles of secondary editor buttons (graphql#2911)

* add missing effect dep for default headers (graphql#2912)

* show multipart requests as running until they are finished or cancelled (graphql#2907)

* show multipart requests as running until they are finished or cancelled

* Improve changeset wording

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* fix grammar

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* fix grammar

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* rename the `initialTabs` prop to `defaultTabs` (graphql#2908)

* rename the `initialTabs` prop to `defaultTabs`

* also bump graphiql package

* improve prop description

* chore(deps): bump loader-utils from 1.4.0 to 1.4.2 (graphql#2914)

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix tabbar overflow (graphql#2919)

* fix: prevent default event for graphiql-doc-explorer-back link (graphql#2905)

* fix: prevent default event for graphiql-doc-explorer-back link

* changeset and formatting

* Version Packages (graphql#2902)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix(sonar-lint): 🐛 fixed doctype and missing html tags (graphql#2835)

* fix(sonar-lint): 🐛 fixed doctype and missing html tags

* Some HTML housekeeping

* unaltered settings

* refactor: 🔒 Added subresource integrity to unpkg cdn links

* Update examples/graphiql-cdn/index.html

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

* Update packages/graphiql/resources/index.html.ejs

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

* fix: support cts/mts extensions (graphql#2926)

Resolves graphql#2855

* Remove side-effect in StorageAPI that overrides localStorage.clear (graphql#2923)

* remove `mapCat()` in favor of `Array#flatMap()`

* enable `no-negated-condition` and `no-else-return` rules (graphql#2931)

* enable `promise/no-multiple-resolved` (graphql#2943)

* enable `sonarjs/no-redundant-jump` rule

* removes regenerator-runtime from cdn.ts (graphql#2939)

* fix workspaces bug on merge (graphql#2953)

* fix changelog formatting issue hopefully (graphql#2957)

* [@graphiql/react]: replace `compose.ts` with `clsx` for class concatenation (graphql#2932)

* check interpolation

* add changeset

* ignore clsx word

* enable `unicorn/throw-new-error` rule (graphql#2938)

* enable `unicorn/prefer-logical-operator-over-ternary` rule (graphql#2941)

* Improved grammar & punctuation in DEVELOPMENT.md (graphql#2927)

* Improved grammar & punctuation in DEVELOPMENT.md

* Update DEVELOPMENT.md

missed a bit

* fix wording and linting

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

* chore(deps-dev): bump express from 4.17.1 to 4.17.3 (graphql#2960)

Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.17.3.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.17.1...4.17.3)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* enable `unicorn/prefer-includes` (graphql#2937)

* enable `unicorn/prefer-includes`

* fix build

* chore(deps): bump qs from 6.5.2 to 6.5.3 (graphql#2959)

Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](ljharb/qs@v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* enable `@typescript-eslint/no-unused-expressions` rule (graphql#2933)

* enable `lonely-if`/`unicorn/lonely-if` rules (graphql#2936)

* enable `lonely-if`/`unicorn/lonely-if`

* do yarn

* extends `plugin:import/recommended` and fix warnings (graphql#2922)

* extends `plugin:import/recommended` and fix warnings

* fix lint in ci

* fix unit tests

* fix e2e

* remove `wonka`/`regenerator-runtime` from dependencies
remove `regenerator-runtime/runtime` import

* remove examples from workspaces

* rebase and enable merged rules

* update examples

* rebase fixes

* Update config.json (graphql#2961)

* avoid literal asterisks, use underscores instead (graphql#2969)

* chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (graphql#2934)

Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* complete (graphql#2972)

* Add Jan 2023 WG agenda (graphql#2988)

* Add user facing setting for persisting headers (graphql#2895)

* feat: Add user facing setting for persisting headers

* Only allow controlling setting if prop value is true/undefined

* Clean up tab storage headers when persising headers turns off

* add warning message

* fix initial value

* restore tabs store if toggling on

* version changes as "minor"

* Simplify logic to show persisting headers settings

* sync persist header prop if it changes

* chore(deps): bump json5 from 1.0.1 to 1.0.2 (graphql#2987)

Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* enable `sonarjs/no-small-switch` and `sonarjs/no-duplicated-branches` rules (graphql#2966)

* enable `unicorn/prefer-export-from` rule (graphql#2964)

* enable `unicorn/prefer-optional-catch-binding` rule (graphql#2965)

* Fix graphiql react issue with setting tabs title (graphql#2968)

* updates fuzzyExtractOperationName regex

* adds/rearranges tests for "comment line handling"

* enable `prefer-destructuring` rule (graphql#2963)

* enable `prefer-destructuring` rule

* fixes

* fix netlify build (cm6 project references fix) (graphql#2992)

* Version Packages (graphql#2928)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: avoid infinity recursiveness in getVariablesJSONSchema (graphql#2917)

* fix: avoid infinity recursiveness in getVariablesJSONSchema

add a marker to mark analyzed InputObject to avoid infinity recursiveness while generating JsonSchema.
set $ref field for definition while recursion is found
put marker into options to avoid extra parameters
add test unit for this bug

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* fix(cm6-graphql): Fix query token used as field name (graphql#2995)

* fix(cm6-graphql): Fix query token used as field name

Use @extend instead of @Specialize
Fixed tests

* Create eighty-spiders-crash.md

* build cm6-graphql

* fix build

* addressed pr feedback

* yarn format

* fix: VariableJSONSchema for custom scalars (graphql#2986)

* 🛠️ ESLint: add `unicorn/consistent-destructuring` rule (graphql#2993)

* add `unicorn/consistent-destructuring` rule

* Fix highlighting for GraphQL errors with multiple nodes (graphql#2913)

* fix eslint error (graphql#3008)

* Fix typo (`/* GraphiQL */` => `/* GraphQL */`) (graphql#3006)

* docs: fix typo

* docs: yarn pretty

* Update README (graphql#3004)

* Remove LGTM grade

https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/

* Remove server from `graphql-language-service-server-cli`

* chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (graphql#3014)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump ua-parser-js from 1.0.2 to 1.0.33 (graphql#3003)

Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 1.0.2 to 1.0.33.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md)
- [Commits](faisalman/ua-parser-js@1.0.2...1.0.33)

---
updated-dependencies:
- dependency-name: ua-parser-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 🛠️ ESLint: enable `unicorn/prefer-node-protocol` rule (graphql#2940)

* enable `unicorn/prefer-node-protocol` rule

* use `"@types/node": "^16.18.4"` since github ci is use node v16

* fix unit tests

* fix

* rebase

* 🛠️ ESLint: clean all ESLint warnings, add `--max-warnings=0` and `--cache` flags (graphql#2962)

* clean all ESLint warnings, add `--max-warnings=0` and `--cache` flags

* format

* rebase

* extends `plugin:@typescript-eslint/recommended` (graphql#2967)

* Add Feb 2023 agenda (graphql#3023)

* update `canuise-lite` (graphql#3018)

* feat: maintain DocExplorer stack on schema update

* feature: add fragment arguments syntax highlights (graphql#3019)

* update cypress to v12.6.0 (graphql#2893)

* update cypress to v11.0.1

* fix lint

* upgrade to webpack 5, re-add monaco workspace

* simplify monaco webpack example

* enable `sonarjs/no-identical-functions`, `sonarjs/no-unused-collection`, `sonarjs/no-extra-arguments` rules (graphql#3038)

* [ESLint] enable `logical-assignment-operators` rule (graphql#3036)

* enable `logical-assignment-operators` rule

* Update GraphQLCache.ts

* format

* lint renderExample.js, cleanup .eslintignore file (graphql#3034)

* extend `plugin:cypress/recommended` config (graphql#3035)

* enable `unicorn/prefer-switch` rule (graphql#3051)

* add an example with next.js and monaco-graphql (graphql#3040)

* finish upgrading webpack & babel dependencies, fix monaco example (graphql#3053)

* a few more tweaks for clean builds on the monaco-graphql-webpack example. 
* reintroduce the monaco example reference workspace, make this a testbed for monaco-graphql development again
* consolidate more babel versions
* upgrade the rest of the webpack & babel ecosystem

* enable `unicorn/no-useless-switch-case` rule (graphql#3049)

* remove nested eslint configs (graphql#3052)

* Version Packages (graphql#3001)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix monaco peer deps and linting (graphql#3071)

* format changes on changesets version before publish (graphql#3073)

* fix: add graphql-language-service as direct dep to cm6-graphql (graphql#3069)



Co-authored-by: Samuel <samuelimolo4real@gmail.com>

* Format on version (graphql#3074)

* try a simpler command to make changesets action happy
* changesets should ignore example-*

* do not suggest `ReactDOM.render(..., document.body)` as it's anti pattern! (graphql#3064)

* fix `vscode-graphql-syntax` readme (graphql#3062)

* enable `unicorn/no-zero-fractions` rule (graphql#3048)

* [ESLint] enable `unicorn/prefer-array-flat-map` rule (graphql#3044)

* enable `unicorn/prefer-array-flat-map` rule

* format

* remove unneeded `reference &&` assertion, convert to switch (graphql#3061)

* enable `unicorn/prefer-string-replace-all` rule (graphql#3043)

* [ESLint] Prefer String#slice() over String#substr() and String#substring() (graphql#3042)

* Prefer String#slice() over String#substr() and String#substring()

* fix tests

* format

* enable `unicorn/prefer-regexp-test` rule (graphql#3045)

* remove redundant `catch` statement (graphql#3033)

* build before lint after version

* [ESLint] enable `unicorn/prefer-at` rule (graphql#3046)

* format

* fixes

* enable `unicorn/prefer-switch` rule (graphql#3050)

* avoid `useMemo` with empty array `[]` since React can't guarantee stable reference, + lint restrict syntax for future mistakes (graphql#3063)

* avoid `useMemo` with empty array `[]` since React can't guarantee stable reference, + lint restrict syntax for future mistakes

* fix migration

* prettify

* fix new build issue (graphql#3078)

* chore(deps): bump undici from 5.10.0 to 5.20.0 (graphql#3027)

Bumps [undici](https://github.com/nodejs/undici) from 5.10.0 to 5.20.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v5.10.0...v5.20.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* use writeFile from `fs/promises` instead `promisify(writeFile)` (graphql#3082)

* use writeFile from fs/promises instead `promisify(writeFile)`

* Delete little-zebras-fry.md

* remove unneeded check for `schema` (graphql#3083)

* remove unneeded check for `schema`

* Delete sweet-dolphins-breathe.md

* refactor `classList.remove` since he accept multiple argument (graphql#3092)

* remove `null` from `ReactNode | null` union (because `null` already value of `ReactNode`) (graphql#3090)

* use promise version of fs.readFile (graphql#3084)

* chore(deps-dev): bump webpack from 5.75.0 to 5.76.0 (graphql#3099)

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* monaco example fixes, fix missing worker bug (graphql#3093)

* monaco example fixes, fix missing worker bug

* avoid bundling code from `react/jsx-runtime` (graphql#3017)

* mark `react/jsx-runtime` as external in `@graphiql/react`
 use classic jsx transform in plugins

* do not destructure `Kind` from graphql (graphql#3085)

* remove nowhere used `entities` dependency (graphql#3087)

* [ESLint] enable `@typescript-eslint/no-unnecessary-type-assertion` (graphql#3086)

* setup rule

* fixes

* prettier

* fixes

* prettier

* fixes

* prettier

* fixes

* prettier

* fixes

* fixes

* set `NODE_OPTIONS=--max-old-space-size=3500`

* set `NODE_OPTIONS=--max-old-space-size=4096`

* add vscode-graphql to the readme (graphql#3104)

vscode-graphql was never added to the root readme!

* [MessageProcessor] move some class field declaration outside of constructor (graphql#3089)

* enable `unicorn/no-array-push-push` rule (graphql#3047)

* chore(deps): bump @sideway/formula from 3.0.0 to 3.0.1 (graphql#3102)

Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sideway/formula/releases)
- [Commits](hapijs/formula@v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: "@sideway/formula"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump webpack in /examples/monaco-graphql-nextjs (graphql#3101)

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.76.2)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update package.json, set NODE_OPTIONS=--max-old-space-size=4096for eslint (graphql#3105)

* Update package.json

* Update pr-check.yml

* remove nowhere used `node-fetch` dependency

* Version Packages

* [ESLint] enable `unicorn/no-typeof-undefined` rule (graphql#3037)

* fix: build on release

* fix: Webpack dev server config before and after middleware and renderExample path (graphql#3110)

* use netlify.toml again (graphql#3131)

* Updated cm6-graphql package README (graphql#3127)



---------

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* feat: add syntax highlighting in Scala (graphql#3106)

* fix: tweak to prevent prettier formatting to the changelog file (graphql#3133)

* [ESLint] replace `.forEach` with `for..of` (graphql#3113)

* [ESLint] enable `@typescript-eslint/no-floating-promises`, update typescript-eslint to v6 (graphql#3109)

* [ESLint] enable `unicorn/prefer-dom-node-remove` (graphql#3122)

* [ESLint] enable `sonarjs/no-ignored-return` (graphql#3119)

* [ESLint] enable `unicorn/prefer-dom-node-append` (graphql#3117)

* [ESLint] enable `unicorn/no-useless-undefined` (graphql#3121)

* [ESLint] enable `no-var` rule (graphql#3041)

* [ESLint] enable `promise/prefer-await-to-then` for non React packages (graphql#3120)

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* [ESLint] Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode` (graphql#3126)

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* Update globals.css, remove duplicate css prop (graphql#3141)

* fix: vue & svelte wo script tag (graphql#3157)

* fix: vue and svelte files doesn't log error when parsing with no script tag (graphql#2836)

* tweak LSP/vscode changelog entry (graphql#3159)

just adding `vscode-graphql` to the changeset so that users see that this terrible bug has been patched1

* Version Packages

* GraphQLCache: fix multiple projects in one graphqlrc

* Version Packages

* fix(graphql-language-service-server): allow getDefinition to work for unions

* Create many-sloths-shop.md

* refactor: Use isTypeDefinitionNode rather than maintaining list directly

* fix(graphql-language-service-server): apply fix to cross-file definitions

* Update .changeset/many-sloths-shop.md

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* Fix changeset formatting (graphql#3162)

* Version Packages

* Fix GraphQLCache to read both documents and schema

* Version Packages

* feat: Use native LSP logger (graphql#3148)

* feat: add all schema types in classic schema documentation (graphql#3077)

* fix: script offset if vue-sfc contains template above (graphql#3135)


Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>

* fix canary releases (graphql#3172)

canary releases should happen even with `paths-ignore` according to the actions documentation

* adds meeting info and agenda stubs for remaining months of 2023

* Version Packages

* Update README.md (graphql#3174)

Tweaks that weren't picked up in https://github.com/graphql/graphiql/pull/3127/files

* fix duplicated vite config (graphql#3180)

* fix duplicated vite config

* add changeset

* Update .gitignore

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* fix: limit all codemirror css rules to .graphiql-container (graphql#3147)

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* Version Packages (graphql#3190)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* add `package-lock.json` to `.gitignore` (graphql#3142)

* ensure code blocks in Markdown don't contain syntax errors + lint code blocks (graphql#3137)

* enable `@typescript-eslint/non-nullable-type-assertion-style` (graphql#3193)

* avoid unnecessary rerenders React components (graphql#3124)

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* [ESLint] Prefer `.textContent` over `.innerText` (graphql#3118)

* replace rest of `event.keyCode` usages by `event.code` (graphql#3136)

* [ESLint] enable `sonar/prefer-promise-shorthand` and `sonar/no-dead-store` rules (graphql#3143)

* fix: fix tab content getting replaced on changeTab (graphql#3194)

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* replaces unneeded backticks with single quotes + lint them! (graphql#3196)

* remove confusing ligatures, set `font-variant-ligatures: none` (graphql#3197)

* Version Packages (graphql#3195)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix ReferenceError: window is not defined in Next.js (graphql#3198)

* Version Packages (graphql#3199)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: make tooltips work when Graphiql is not full page and window has scrolled (graphql#3203)

* 1️⃣ replace `@reach/dialog` by `@radix-ui/react-dialog` and `@reach/visually-hidden` by `@radix-ui/react-visually-hidden` (graphql#3181)

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: Myles Murphy <53157254+mylesmmurphy@users.noreply.github.com>

* Update pre.json (graphql#3208)

* Version Packages (alpha) (graphql#3205)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* renames file and updates copy (graphql#3218)

* fix: Hover docs were offset one position (graphql#3149)

* chore(deps-dev): bump vite from 2.9.13 to 2.9.16 (graphql#3215)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix livedemo link Update README.md (graphql#3222)

* use VSCE_PAT only (graphql#3223)

this is more descriptive, prevents confusion because PAT_TOKEN could refer to anything

* try removing some packages from pre.json (graphql#3224)

* try removing some packages from pre.json

I think we tried this before, but let's see what happens?

* add changeset to trigger canary pipeline

* add note about graphiql dev URL (graphql#3226)

* fix broken graphql.org links Update README.md (graphql#3227)

* enable `@typescript-eslint/consistent-type-assertions` (graphql#3232)

* remove root's package.json `@types/react` and `@types/react-dom` (graphql#3233)

* [@graphiql/react]: exclude peer dependencies and dependencies from bundle (graphql#3228)

* [plugin-code-exporter/plugin-explorer]: exclude peer dependencies and dependencies from bundle (graphql#3229)

* remove storybook references (graphql#3239)

* fix: make `@types/codemirror` a dependency of `@graphiql/react` (graphql#2716)

Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* add cm6-graphql to the readme (graphql#3240)

* add cm6-graphql to the readme

provide waypoints for cm5 vs cm6 users

* tweak badges

* tweak

* fix header link for cm6-graphql (graphql#3241)

* fix: reload schema when a change to the schema file is detected (graphql#3216)

* fix: Invalidate the schema when the file has been changed

* feat: add .json file ending to register changes in introspection files

* fix: handle all types of graphql schema

* feat: changeset

* Fix open vsx publish (graphql#2833)

* fix ovsx publishing
* attempt to get ovsx working
* fix: CLI invocation to publish local contexts

* Version Packages (alpha) (graphql#3219)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* reintroduce codecov (graphql#3244)

* reintroduce codecov

* fix path

* re-add coverage flag

* more config tweaks

* fix: run tests against main for baseline (graphql#3245)

* fix: run tests against main for baseline
* make e2e happen only on PRs
* fix codecov targets

* set target really low (graphql#3247)

* fix: restore tests without build workflow (graphql#3246)

* leave pre-release mode (graphql#3248)

* [plugin-code-exporter/plugin-explorer] update vite (graphql#3236)

* always bundle `package.json#dependencies` for UMD for `@graphiql/plugin-code-exporter` and `@graphiql/plugin-explorer` (graphql#3251)

* fix

* remove `/// <reference path='../../node_modules/monaco-editor/monaco.d.ts'/>` and simple import it (graphql#3238)

* remove `/// <reference path='../../node_modules/monaco-editor/monaco.d.ts'/>` and simple import it
* avoid `import * as monaco`
* prefer `import type * as monaco`

* [graphiql] remove unnecessary `<div />` wrappers (graphql#3235)

* update eslint plugins/prettier (graphql#3255)

* update lint

* update prettier

* simplify prettier checks commands, remove `script/pretty.js` (graphql#3259)

* [monaco-graphql]  remove newline trigger character (graphql#3253)

* fix release (graphql#3260)

* ignore package.jsons for cspell (graphql#3262)

* ignore `package.json`s for cspell

* better

* Update CONTRIBUTING.md (graphql#3261)

* improvements (graphql#3263)

* Delete index.js.flow (graphql#3256)

* Delete index.js.flow

* Delete index.js.flow

* Delete buildFlow.js (graphql#3257)

* Update .prettierignore

* fix exec and the dreaded code file loader bug (graphql#3266)

* fix exec and the dreaded code file loader bug
* fix: allow passing in additional extensions
* fix: eslint extension bundling externals

* Fix changesets (graphql#3268)

* Version Packages (graphql#3243)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix ovsx release (graphql#3269)

* Version Packages (graphql#3270)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix vscode-graphql-extension release (graphql#3271)

* Version Packages (graphql#3272)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix vscode issue with esbuild + vsce bundling (graphql#3274)

* Version Packages (graphql#3275)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* setup `@shopify/prefer-early-return` and `sonarjs/no-inverted-boolean-check` (graphql#3276)

* fixes for `prefer-class-properties` (graphql#3277)

Co-Authored-By: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* enable avoidExplicitReturnArrows: true option for `object-shorthand` rule (graphql#3283)

* enable `prefer-arrow-callback` (graphql#3282)

* simplify `monaco-graphql-react-vite` example, fix sending variables (graphql#3140)

* lower codecov threshold

.1% seems forgiving enough

* simplify Next.js example + add symlinks to React Vite to maintain 2 examples from 1 place (graphql#3281)

* Delete types.js.flow (graphql#3286)

* remove unneeded mock to cross-fetch (graphql#3289)

* fix umd build names `graphiql-plugin-code-exporter.umd.js` and `graphiql-plugin-explorer.umd.js` (graphql#3292)

* Version Packages (graphql#3280)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix (graphql#3293)

* simplify imports from `graphql`, restrict some with eslint (graphql#3294)

* update regression test matrix (graphql#3296)

we only need to worry about old 15.x versions and latest 16.x that we support.

* add `/* GraphQL */` comments in merge-ast.spec.ts (graphql#3302)

* fix: run tests for commits that include markdown, etc changes

previously, if you opened a PR that included any markdown changes, even if there were also code changes, the ci would skip tests

essentially, `paths-ignore` does not work the way we hope

* Update README.md (graphql#3308)

* replace `express-graphql` with `graphql-http` (graphql#3310)

* replace `express-graphql` with `graphql-http`
* upgrade express

* Fix eslint errors (graphql#3315)

* fix(graphiql-plugin-explorer): Use named `Explorer` import from `graphiql-explorer` (graphql#3319)

* fix(graphiql-plugin-explorer): Use preferDefault helper

* Create shaggy-eyes-melt.md

* Update packages/graphiql-plugin-explorer/src/index.tsx

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>

* remaining fix to use explorer import

* adjust changelog

---------

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>

* Revert "update regression test matrix" (graphql#3320)

* Version Packages (graphql#3295)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [tooling] use cspell `--no-must-find-files` on git hooks, simplify output (graphql#3313)

* [documentation] fix `ISSUE_TEMPLATE` bugs (graphql#3321)

* fix ISSUE_TEMPLATE bugs

* `render: markdown` leads to a terrible experience for `textarea`, both
  for editing & reading the text
* almost everyone prefers using `*` for md lists over `-`
* eliminate sections that are confusing and rarely used (including the
  templates for `monaco-graphql`)
* convert the syntax bug reporting template to markdown, as there is
  little context that needs to be provided besides a screenshot
* type markdown -> type textarea

* [tooling] combine webpack builds for faster builds & simpler tooling (graphql#3323)

* fix: bypass parsing bugs to continue plucking tags (graphql#3322)

* avoid bundling unnecesary languages, except `graphql`/`json` (graphql#3285)

* simplify `monaco-graphql-react-vite`, fix sending variables

---------

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>

* [graphiql] fix graphql#2859, graphiql plugin lifecycle bugs, simplify plugins (graphql#3330)

- simplify plugin development
- simplify plugin implementation
- fix graphql#2859 cursor jumping issue
- drop the `use` prefix, because they should not be invoked as react hooks, but widely used eslint rules will assume they are hooks
- update examples for 0.2.0 breaking change
- consistent naming
  - `@graphiql/plugin-code-exporter` -> exports `codeExporterPlugin()` module
  - `@graphiql/plugin-explorer` ->  exports `explorerPlugin()` module

* `.prettierignore` => `.eslintignore`, mutual ignore rules, cleanup prettier config (graphql#3333)

* use ignorePatterns instead (graphql#3334)

another attempt to fix the eslint/prettier config mismatch on release

* Version Packages (graphql#3326)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Feat: history enhancements (graphql#3130)

- Adds a trash icon to delete individual items
- Adds a clear button to clear all history
- Changes so item not in both items list and favorites list
- Fixes so it edits the correct label if the same operation is in the list twice
- Adds a callback for when you click an item and it's set as the active item in editor (helpful for customizing UI based on when query changes)
- Pass in entire item and de-structure needed properties in history store instead (helpful if you're customizing to build your own <HistoryContext.Provider... i.e. customizing the addToHistory/editLabel/etc functions to use a backend instead of a local storage and may need a unique id or other properties. Without passing the entire item there's no way to receive those extra properties but passing the entire item allows that)
---------

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: Myles Murphy <53157254+mylesmmurphy@users.noreply.github.com>

* handle null editor value in explorer plugin

* Version Packages

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris <ccbrown112@gmail.com>
Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Stefan Schneider <stefan.schneider@gmx.net>
Co-authored-by: Elijah Olmos <35435704+elijaholmos@users.noreply.github.com>
Co-authored-by: Victor Tortolero <victormtortolero@gmail.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: woodensail <woodensail@hotmail.com>
Co-authored-by: Samuel <samuelimolo4real@gmail.com>
Co-authored-by: Benoît Bouré <benoit.boure@gmail.com>
Co-authored-by: Ivan Buryak <11bit@users.noreply.github.com>
Co-authored-by: mizdra <pp.mizdra@gmail.com>
Co-authored-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
Co-authored-by: Benjie Gillam <benjie@jemjie.com>
Co-authored-by: Matt Mahoney <mahoney.mattj@gmail.com>
Co-authored-by: Sergei Chestakov <me@sergei.com>
Co-authored-by: Myles Murphy <53157254+mylesmmurphy@users.noreply.github.com>
Co-authored-by: Hugo van Rijswijk <git@hugovr.nl>
Co-authored-by: JYC <jycouet@gmail.com>
Co-authored-by: Sterling Camden <rusty.camden@gmail.com>
Co-authored-by: Aaron Moat <2937187+AaronMoat@users.noreply.github.com>
Co-authored-by: Mark Skelton <mdskelton99@gmail.com>
Co-authored-by: Zolwiastyl <45352717+Zolwiastyl@users.noreply.github.com>
Co-authored-by: puelo <tobias-ka@gmx.de>
Co-authored-by: Jake Harclerode <Jakobharclerode@gmail.com>
Co-authored-by: Daniel Woelfel <dwwoelfel@gmail.com>
Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
Co-authored-by: lesleydreyer <38596053+lesleydreyer@users.noreply.github.com>
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
Co-authored-by: Simen Owesen-Lein <simowe@attensi.com>
Co-authored-by: Lennart <lekoarts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graphiql potential plugin A potential plugin idea for later versions of GraphiQL
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[graphiql] user-facing setting for persisting headers
4 participants