Skip to content

Commit

Permalink
fix(react): remove await
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Oct 18, 2023
1 parent c380791 commit 6498557
Show file tree
Hide file tree
Showing 40 changed files with 820 additions and 64 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
command: ['pnpm lint', 'pnpm lint:pub', 'pnpm test', 'pnpm test:tsd', 'pnpm type:check']
command: ['lint', 'lint:attw', 'lint:pub', 'test', 'test:tsd', 'type:check']
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
Expand All @@ -31,4 +31,4 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm prepack
- name: Run commands
run: ${{ matrix.command }}
run: pnpm ${{ matrix.command }}
3 changes: 2 additions & 1 deletion docs/src/pages/docs/_meta.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"intro": "Getting Started",
"links": "Related Links",
"react": "@suspensive/react",
"react-query": "@suspensive/react-query"
"react-query": "@suspensive/react-query",
"react-await": "@suspensive/react-await"
}
3 changes: 2 additions & 1 deletion docs/src/pages/docs/_meta.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"intro": "시작하기",
"links": "관련 링크",
"react": "@suspensive/react",
"react-query": "@suspensive/react-query"
"react-query": "@suspensive/react-query",
"react-await": "@suspensive/react-await"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Afterwards, when the Promise is fulfilled, the guaranteed awaited data can be us
Additionally, this data is cached in the received key and can be used immediately without pending when reused.

```tsx
import { Await, Suspense } from '@supensive/react'
import { Await } from '@suspensive/react-await'
import { Suspense } from '@suspensive/react'

const getPost = (postId: number) => fetch(`/post/${postId}`).then((res) => res.json()) as Post

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { Callout } from 'nextra/components'
또한 이 data는 받은 키에 cache되어 재사용하는 경우 pending없이 즉시 사용할 수 있습니다.

```tsx
import { Await, Suspense } from '@supensive/react'
import { Await } from '@suspensive/react-await'
import { Suspense } from '@suspensive/react'

const getPost = (postId: number) => fetch(`/post/${postId}`).then((res) => res.json()) as Post

Expand Down
4 changes: 4 additions & 0 deletions docs/src/pages/docs/react-await/_meta.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"installation": { "title": "Installation" },
"Await": { "title": "<Await/>" }
}
4 changes: 4 additions & 0 deletions docs/src/pages/docs/react-await/_meta.ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"installation": { "title": "설치하기" },
"Await": { "title": "<Await/>" }
}
7 changes: 7 additions & 0 deletions docs/src/pages/docs/react-await/installation.en.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Installation

@suspensive/react-await package lives in npm. To install the latest stable version, run the following command

```shell npm2yarn
npm install @suspensive/react-await
```
7 changes: 7 additions & 0 deletions docs/src/pages/docs/react-await/installation.ko.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 설치하기

@suspensive/react-await는 npm에 있습니다. 최신 안정버전을 설치하기 위해 아래 커맨드를 실행하세요

```shell npm2yarn
npm install @suspensive/react-await
```
3 changes: 1 addition & 2 deletions docs/src/pages/docs/react/_meta.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"ErrorBoundaryGroup": { "title": "<ErrorBoundaryGroup/>" },
"Delay": { "title": "<Delay/>" },
"AsyncBoundary": { "title": "<AsyncBoundary/>" },
"SuspensiveProvider": { "title": "<SuspensiveProvider/>" },
"Await": { "title": "<Await/>" }
"SuspensiveProvider": { "title": "<SuspensiveProvider/>" }
}
3 changes: 1 addition & 2 deletions docs/src/pages/docs/react/_meta.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"ErrorBoundaryGroup": { "title": "<ErrorBoundaryGroup/>" },
"Delay": { "title": "<Delay/>" },
"AsyncBoundary": { "title": "<AsyncBoundary/>" },
"SuspensiveProvider": { "title": "<SuspensiveProvider/>" },
"Await": { "title": "<Await/>" }
"SuspensiveProvider": { "title": "<SuspensiveProvider/>" }
}
4 changes: 2 additions & 2 deletions docs/src/pages/docs/react/installation.ko.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 설치하기

@suspensive/react npm에 있습니다. 최신 안정버전을 설치하기 위해 아래 커맨드를 실행하세요
@suspensive/react-await npm에 있습니다. 최신 안정버전을 설치하기 위해 아래 커맨드를 실행하세요

```shell npm2yarn
npm install @suspensive/react
npm install @suspensive/react-await
```
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"graph": "rimraf ./graph && mkdir graph && turbo run build --graph=graph/index.html",
"lint": "turbo run lint",
"lint:attw": "turbo run lint:attw",
"lint:pack": "packlint sort -R",
"lint:pub": "turbo run lint:pub",
"postinstall": "husky install",
Expand All @@ -44,6 +45,7 @@
"type:check": "turbo run type:check --parallel"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.12.2",
"@changesets/cli": "^2.26.1",
"@commitlint/cli": "^17.6.1",
"@commitlint/config-conventional": "^17.6.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-await/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: ['@suspensive/eslint-config/react-ts'],
ignorePatterns: ['*.js*', 'dist', 'coverage'],
}
211 changes: 211 additions & 0 deletions packages/react-await/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
# @suspensive/react

## 1.16.1

### Patch Changes

- d415299: chore: remove docs in packages

## 1.16.0

### Minor Changes

- a711c19: feat(react): add useErrorBoundaryFallbackProps

## 1.15.5

### Patch Changes

- 62c3384: chore(eslint): add no-duplicates, consistent-type-imports

## 1.15.4

### Patch Changes

- ba1e1a6: refactor(react): to easier code

## 1.15.3

### Patch Changes

- b05b4e2: docs(react): update doc for Delay
- e1e9a6b: docs(react): update doc for ErrorBoundaryGroup

## 1.15.2

### Patch Changes

- cbfbc02: docs(docusaurus): add npm2yarn plugin
- cfcafd2: docs(react): update tips as admonitions

## 1.15.1

### Patch Changes

- 5dfdf71: fix: remove awaitClient from ErrorBoundary
- c9bc99d: docs: update experimental feature mark as admonitions of docusaurus

## 1.15.0

### Minor Changes

- b431a4d: feat(react): add useErrorBoundary

## 1.14.9

## 1.14.8

### Patch Changes

- dd75647: feat(react): add getError, remove unnecessary generic
- a803b48: fix(react): fix ErrorBoundary reset using render prop

## 1.14.7

### Patch Changes

- 085cbe6: refactor(react): apply assert

## 1.14.6

### Patch Changes

- eac6832: fix(react): add assertion function to assert condition

## 1.14.5

### Patch Changes

- da0bd52: refactor(react): clarify variable name
- 2c30f6d: refactor(react): add useSetTimeout to reduce code

## 1.14.4

### Patch Changes

- 8d8ef53: fix(react): object that elment of key don't care field's order by hashKey
- 482cfc4: fix(react): update BaseErrorBoundary method simply
- d636e85: fix(react): ErrorBoundary should catch null thrown by children
- 8d8ef53: fix(react): replace useEffect to use-sync-external-store

## 1.14.3

### Patch Changes

- da62f3a: refactor(react): merge hoc's code into original component file

## 1.14.2

### Patch Changes

- ada618e: chore(package.json): more detail

## 1.14.1

### Patch Changes

- c5906c9: refactor(react, react-query): remove **test** directory to collocate

## 1.14.0

### Minor Changes

- 252d1d3: fix(react): rename useSuspenseCache to useAwait, suspenseCache to SuspensiveCache

## 1.13.0

### Minor Changes

- 95be8a2: fix(react): change experimental Delay, SuspensiveProvider to stable

## 1.12.2

### Patch Changes

- 6237e94: feat(vitest): add @suspensive/vitest generating named config automatically by packageJson.name
- 6c5e097: ci(test): migrate jest to vitest

## 1.12.1

### Patch Changes

- 7109191: fix(esm): cjs to esm as default

## 1.12.0

### Minor Changes

- e3df644: feat(react): add ErrorBoundaryFallbackProps type

### Patch Changes

- f4b1ac7: fix(react): enable hook in ErrorBoundary
- 8c23785: refactor(eslint, tsconfig): simply

## 1.11.7

### Patch Changes

- f23a241: fix(typescript): update version from v4 to v5

## 1.11.6

### Patch Changes

- eb8b6a9: fix(react, react-query): remove unnecessary files by package.json's files

## 1.11.5

### Patch Changes

- resolve @suspensive/tsup error

## 1.11.4

### Patch Changes

- 80cc215: chore(bundler): migrate from rollup to tsup

## 1.11.4-beta.0

### Patch Changes

- 5b87ae4: chore(bundler): migrate from rollup to tsup

## 1.11.3

### Patch Changes

- a9b97c2: fix(react): remove ErrorBoundaryGroup's unnecessary rerender by usePrevious, remove not on purpose situation's group.reset by isMounted's side effect

## 1.11.2

### Patch Changes

- ef0350c: fix(react): fix useErrorBoundaryGroup to guarantee parent ErrorBoundaryGroup

## 1.11.1

## 1.11.0

### Minor Changes

- a89dd4f: feat(react): add useSuspenseCache, suspenseCache(experimental)

## 1.10.0

## 1.9.6

### Patch Changes

- 1a9f364: fix(react): add next.js appRouter 'use client' directive

## 1.9.5

## 1.9.4

## 1.9.3

### Patch Changes

- 6e99b89: changelog initialization
21 changes: 21 additions & 0 deletions packages/react-await/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Suspensive

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions packages/react-await/README.ko.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 라이브러리 소개

@suspensive/react는 React suspense를 쉽게 사용하기 위한 모든 컴포넌트를 제공합니다.

[![npm version](https://img.shields.io/npm/v/@suspensive/react?color=000&labelColor=000&logo=npm&label=)](https://www.npmjs.com/package/@suspensive/react)
[![npm](https://img.shields.io/npm/dm/@suspensive/react?color=000&labelColor=000)](https://www.npmjs.com/package/@suspensive/react)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/@suspensive/react?color=000&labelColor=000)](https://www.npmjs.com/package/@suspensive/react)

## 설치하기

@suspensive/react 는 npm에 있습니다. 최신 안정버전을 설치하기 위해 아래 커맨드를 실행하세요

```shell npm2yarn
npm install @suspensive/react
```
15 changes: 15 additions & 0 deletions packages/react-await/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Introduction

@suspensive/react provide all components to use React Suspense easily.

[![npm version](https://img.shields.io/npm/v/@suspensive/react?color=000&labelColor=000&logo=npm&label=)](https://www.npmjs.com/package/@suspensive/react)
[![npm](https://img.shields.io/npm/dm/@suspensive/react?color=000&labelColor=000)](https://www.npmjs.com/package/@suspensive/react)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/@suspensive/react?color=000&labelColor=000)](https://www.npmjs.com/package/@suspensive/react)

## Installation

@suspensive/react lives in npm. To install the latest stable version, run the following command

```shell npm2yarn
npm install @suspensive/react
```
Loading

0 comments on commit 6498557

Please sign in to comment.