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

Convert to pnpm to fix autocompletions #442

Merged
merged 12 commits into from
Aug 9, 2023

Conversation

u9g
Copy link
Contributor

@u9g u9g commented Aug 8, 2023

By converting to pnpm we can now patch our dependencies which is amazing since most of our meaningful code lies in our dependencies.

Changes made in this pr:

Started depending on a bunch of new packages.

Explanation: We already depended on them, our package manager just wasn't aware of that since npm probably has some tricks pnpm doesn't, or something along those lines.

Update react-router-dom

Explanation: It was causing some issues with pnpm, but I also don't think it causes any issues to update it in this pr.

Use react-router-dom in experiments/browser_based_querying/src/QueryFragmentAdapter.tsx

Explanation: We used react-router-dom and react-router together, which caused problems for pnpm, so we had to pick one according to SO, and it was easier to move to react-router-dom.

Patches I've added:

experiments/browser_based_querying/patches/graphql-language-service@5.1.7.patch => The change to esm/interface/getAutocompleteSuggestions.js will fix autocompletions giving a directive when you wanted to autocomplete a field. Should still allow autocompleting directives after fields.

The change to esm/interface/getDiagnostics.js will close #285.

experiments/browser_based_querying/patches/monaco-editor@0.20.0.patch => Stop randomly logging from the lexer.

u9g added 4 commits August 7, 2023 22:54
Adds a patch so that we can don't get directive autocompletions
on the line after a directive. Instead, we get the field autocompletion
that the user was expecting.
@u9g
Copy link
Contributor Author

u9g commented Aug 8, 2023

To note: we get these warnings on install, but they can be fixed in a future pr:

 WARN  deprecated core-js@3.22.5: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
Packages: -1
-
Progress: resolved 717, reused 717, downloaded 0, added 1, done
 WARN  Issues with peer dependencies found
.
└─┬ monaco-graphql 1.2.0
  └── ✕ unmet peer prettier@"^2.8.0 || ^3.0.0": found 2.6.2

@obi1kenobi
Copy link
Owner

We used react-router-dom and react-router together, which caused problems for pnpm

Can you say more about the problems here and why we needed to switch?

@u9g
Copy link
Contributor Author

u9g commented Aug 8, 2023

We used react-router-dom and react-router together, which caused problems for pnpm

Can you say more about the problems here and why we needed to switch?

Reference: https://stackoverflow.com/a/73713976
Description says to not use react-router directly: https://www.npmjs.com/package/react-router

So we now use only react-router-dom

experiments/browser_based_querying/README.md Outdated Show resolved Hide resolved
experiments/browser_based_querying/README.md Outdated Show resolved Hide resolved
Comment on lines 21 to 25
invariant(lines.length >= location.line, 'Query text must have more lines than where the error happened');
let stream = null;
- for (let i = 0; i < location.line; i++) {
+ for (let i = 0; i <= location.line; i++) {
stream = new CharacterStream(lines[i]);
Copy link
Owner

Choose a reason for hiding this comment

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

This doesn't seem quite right to me. The invariant above only asserts that lines[i] is valid if i < location.line, not if i == location.line. Either the invariant needs to change as well, or this is not the right change to make.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I had to change the invariant in the pr: graphql/graphiql#3397

This isn't a huge problem for us, we can just get rid of this patch and wait until that pr is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(it does work in it's current form too though...)

@obi1kenobi obi1kenobi enabled auto-merge (squash) August 9, 2023 00:53
@obi1kenobi obi1kenobi merged commit 1dddc0f into obi1kenobi:main Aug 9, 2023
12 checks passed
@u9g u9g deleted the better-autocompletions branch August 9, 2023 00:56
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.

Hovering comments on the playground throws an error (and sometimes an overlay)
2 participants