Skip to content

Commit d88239a

Browse files
authored
Merge pull request #7 from MFB-Technologies-Inc/fix-published-package
Fix published package
2 parents 860e2b0 + a8b85c3 commit d88239a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+29005
-50
lines changed

.github/workflows/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
- name: Install packages
2121
run: npm install
2222

23-
- name: Check formatting
24-
run: npm run check-formatting
25-
23+
- name: Build project and dependencies
24+
run: npm run build
25+
2626
- name: Run unit tests and generate report
2727
run: npm run test:ci
2828

CONTRIBUTING.md

-13
This file was deleted.

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ At the core of this package is `createAsyncRenderer`, which renders specific JSX
1616

1717
```tsx
1818
function useMyData() {
19+
// Setup status state to reflect the state of your long running process
1920
const [status, setStatus] = useState<AsyncRequestStatus>(AsyncRequestStatus.INIT)
21+
// Setup error state for any errors associated with your long running process
2022
const [error, setError] = useState<null | string>(null)
23+
// Setup data state for any data returned from your long running process
2124
const [data, setData] = useState<null | string>(null)
2225

2326
// Logic to kick off a request for data and update local state respectively...
@@ -31,6 +34,7 @@ function useMyData() {
3134

3235
function MyDataComponent() {
3336
const myData = useMyData()
37+
// Create a renderer for your long running process
3438
const loadingRenderer = createAsyncRenderer({
3539
status: myData.status,
3640
error: myData.error,
@@ -86,9 +90,11 @@ These other utility functions can be used to simplify the logic around `createAs
8690
- `getCascadedAsyncState`: Reduces a chain of asynchronous request objects down one asynchronous request object.
8791
- `getOptimisticAsyncLoadState`: Converts its arguments into an optimistic asynchronous request object such that if the arguments indicate a pending asynchronous request and a fulfilled asynchronous request, then the result is a fulfilled asynchronous request object.
8892

89-
## Contributing
93+
Checkout the [example application](./example/README.md).
9094

91-
[Contributing](./CONTRIBUTING.md)
95+
## License
96+
97+
[MIT License](./LICENSE)
9298

9399
## Changelog
94100

example/.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

example/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# example
2+
3+
Example of how to use the exports of `@mfbtech/react-async-renderer`.
4+
5+
Requires `@mfbtech/react-async-renderer` to be packed. Run `npm run package` in the parent directory to pack `@mfbtech/react-async-renderer`.

0 commit comments

Comments
 (0)