Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
doloboyz committed Jun 9, 2024
1 parent db41323 commit d9805b1
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 25 deletions.
6 changes: 3 additions & 3 deletions examples/01_minimal/relay.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
export default {
language: 'typescript',
src: `${__dirname}/src`,
schema: `${__dirname}/data/schema.graphql`,
src: '../src',
schema: './data/schema.graphql',
exclude: ['**/node_modules/**', '**/__mocks__/**', '**/__generated__/**'],
};
2 changes: 1 addition & 1 deletion examples/02_typescript/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense } from 'react';
import { Suspense } from 'react';
import { Provider, useAtom } from 'jotai/react';
import { createStore } from 'jotai/vanilla';
import { environmentAtom, atomWithQuery } from 'jotai-relay';

Check failure on line 4 in examples/02_typescript/src/App.tsx

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'jotai-relay' or its corresponding type declarations.
Expand Down
1 change: 0 additions & 1 deletion examples/02_typescript/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';

import App from './App';
Expand Down
5 changes: 3 additions & 2 deletions examples/03_errorhandling/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Suspense } from 'react';
import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
import { Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import type { FallbackProps } from 'react-error-boundary';
import { Provider, useAtom, useSetAtom } from 'jotai/react';
import { atom, createStore } from 'jotai/vanilla';
import { environmentAtom, atomWithQuery } from 'jotai-relay';

Check failure on line 6 in examples/03_errorhandling/src/App.tsx

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'jotai-relay' or its corresponding type declarations.
Expand Down
1 change: 0 additions & 1 deletion examples/03_errorhandling/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';

import App from './App';
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"graphql": "^16.8.1",
"happy-dom": "^14.12.0",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
19 changes: 16 additions & 3 deletions pnpm-lock.yaml

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

5 changes: 3 additions & 2 deletions src/atomWithMutation.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { atom, Getter, WritableAtom } from 'jotai/vanilla';
import { atom } from 'jotai/vanilla';
import type { Getter, WritableAtom } from 'jotai/vanilla';
import type {
Disposable,
Environment,
MutationConfig,
MutationParameters,
} from 'relay-runtime';
import { commitMutation } from 'relay-runtime';
import { environmentAtom } from './environmentAtom';
import { environmentAtom } from './environmentAtom.js';

/**
* Creates a Jotai atom with a Relay mutation.
Expand Down
3 changes: 2 additions & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Environment, Subscribable } from 'relay-runtime';
import type { atom, Getter } from 'jotai/vanilla';
import type { Getter } from 'jotai/vanilla';
import { atom } from 'jotai/vanilla';
import { atomWithObservable } from 'jotai/vanilla/utils';

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/01_basic.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as src from '../src/index.js';
import { expect, test } from 'vitest';

test('should export functions', () => {
expect(src.environmentAtom).toBeDefined();
expect(src.atomWithQuery).toBeDefined();
expect(src.atomWithMutation).toBeDefined();
expect(src.atomWithSubscription).toBeDefined();
});
11 changes: 0 additions & 11 deletions tests/01_basic_spec.tsx

This file was deleted.

0 comments on commit d9805b1

Please sign in to comment.