Skip to content

Commit

Permalink
🐛 Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aexol committed Sep 28, 2023
1 parent 66bb7a4 commit a0c56f7
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 32 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/editor-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-editor-worker",
"version": "6.9.6",
"version": "6.9.7",
"private": false,
"license": "MIT",
"description": "Visual node editor for GraphQL",
Expand Down
19 changes: 14 additions & 5 deletions packages/editor-worker/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ const moveErrorsByLibraryPadding = (libraries: string) => {
const allowMultipleDirectivesAtLocation = (s: string) => {
return !s.match(new RegExp(/directive(.*)can only be used once/));
};

const allowNoSchemaDefinition = (s: string) => {
return !s.includes("Query root type must be provided");
};

export const catchSchemaErrors = (
schema: string,
libraries = ""
Expand All @@ -72,19 +77,23 @@ export const catchSchemaErrors = (
if (errors.length > 0) {
return errors
.filter((e) => allowMultipleDirectivesAtLocation(e.message))
.filter((e) => allowNoSchemaDefinition(e.message))
.map((e) => {
return paddingFunction({
__typename: "local",
error: e,
});
});
}
return validateTypes(code).map((e) => {
return paddingFunction({
__typename: "local",
error: e,
return validateTypes(code)
.filter((e) => allowMultipleDirectivesAtLocation(e.message))
.filter((e) => allowNoSchemaDefinition(e.message))
.map((e) => {
return paddingFunction({
__typename: "local",
error: e,
});
});
});
} catch (error) {
if (
typeof error === "object" &&
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-editor",
"version": "6.9.6",
"version": "6.9.7",
"private": false,
"license": "MIT",
"description": "Visual node editor for GraphQL",
Expand Down Expand Up @@ -45,7 +45,7 @@
"file-saver": "^2.0.5",
"framer-motion": "^10.12.16",
"fuzzyjs": "^5.0.1",
"graphql-editor-worker": "^6.9.6",
"graphql-editor-worker": "^6.9.7",
"graphql-js-tree": "^1.0.5",
"graphql-language-service": "3.1.4",
"html-to-image": "^1.10.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/shared/errors/ErrorItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type ErrorItemProps = {
};

const Main = styled(Stack)`
color: ${({ theme }) => theme.error.light};
color: ${({ theme }) => theme.text.default};
font-size: 0.75rem;
`;

Expand Down
42 changes: 30 additions & 12 deletions packages/editor/src/shared/errors/ErrorsList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from "react";
import React, { useState } from "react";
import { fontFamilySans } from "@/vars";
import styled from "@emotion/styled";
import { Stack, Typography } from "@aexol-studio/styling-system";
import {
ChevronDownDouble,
ChevronUpDouble,
Stack,
Typography,
} from "@aexol-studio/styling-system";

export const ErrorWrapper = styled(Stack)`
font-family: ${fontFamilySans};
Expand Down Expand Up @@ -29,10 +34,15 @@ const List = styled(Stack)`
padding: 0.5rem;
`;
const SmallLabel = styled(Typography)``;
const IconBox = styled(Stack)`
cursor: pointer;
color: ${(p) => p.theme.text.default};
`;

export const ErrorsList: React.FC<{
children?: React.ReactNode;
}> = ({ children }) => {
const [shrink, setShrink] = useState(false);
return (
<ErrorWrapper
direction="column"
Expand All @@ -41,16 +51,24 @@ export const ErrorsList: React.FC<{
onClick={(e) => e.stopPropagation()}
>
<Errors gap="0.5rem" direction="column">
<SmallLabel
variant="caption"
textTransform="uppercase"
fontWeight={700}
>
problems
</SmallLabel>
<List gap="0.25rem" direction="column">
{children}
</List>
<Stack justify="between">
<SmallLabel
variant="caption"
textTransform="uppercase"
fontWeight={700}
>
problems
</SmallLabel>
<IconBox align="center" onClick={() => setShrink(!shrink)}>
{!shrink && <ChevronDownDouble />}
{shrink && <ChevronUpDouble />}
</IconBox>
</Stack>
{!shrink && (
<List gap="0.25rem" direction="column">
{children}
</List>
)}
</Errors>
</ErrorWrapper>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/sandbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sandbox",
"version": "6.9.6",
"version": "6.9.7",
"private": false,
"license": "MIT",
"description": "Visual node editor for GraphQL",
Expand Down Expand Up @@ -48,7 +48,7 @@
"@aexol-studio/styling-system": "^0.0.8",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"graphql-editor": "^6.9.6",
"graphql-editor": "^6.9.7",
"graphql-js-tree": "^0.1.6",
"socket.io-client": "^4.7.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/socket-live-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "socket-live-test",
"version": "1.0.4",
"version": "1.0.5",
"description": "testing editor live",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/svg-ts-sync/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svg-ts-sync",
"version": "0.8.6",
"version": "0.8.7",
"private": false,
"license": "MIT",
"description": "Sync folders with svg's to react typescript components",
Expand Down

0 comments on commit a0c56f7

Please sign in to comment.