Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions package-lock.json

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

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"homepage": "https://replicache.dev",
"repository": "github:rocicorp/replicache-react",
"main": "out/index.js",
"module": "out/index.mjs",
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the revert command did that or something. Wasn't purposeful.

"scripts": {
"format": "prettier --write 'src/*.{js,jsx,json,ts,tsx,html,css,md}' '*.{cjs,js,jsx,json,ts,tsx,html,css,md}'",
"check-format": "prettier --check 'src/*.{js,jsx,json,ts,tsx,html,css,md}' '*.{cjs,js,jsx,json,ts,tsx,html,css,md}'",
Expand All @@ -20,7 +19,13 @@
"license": "ISC",
"peerDependencies": {
"react": ">=16.0 <19.0",
"react-dom": ">=16.0 <19.0"
"react-dom": ">=16.0 <19.0",
"replicache": ">=4.0.1 <12.0"
},
"peerDependenciesMeta": {
"replicache": {
"optional": true
}
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
Expand All @@ -37,7 +42,7 @@
"prettier": "^2.4.1",
"react": ">=16.0 <18.0",
"react-dom": ">=16.0 <18.0",
"replicache": "10.0.0",
"replicache": "^11.0.0",
"snowpack": "^3.8.8",
"typescript": "^4.4.3"
},
Expand Down
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import type {ReadonlyJSONValue, ReadTransaction} from 'replicache';
import {useEffect, useState} from 'react';
import {unstable_batchedUpdates} from 'react-dom';

type Subscribable = Pick<Replicache, 'subscribe'>;

// We wrap all the callbacks in a `unstable_batchedUpdates` call to ensure that
// we do not render things more than once over all of the changed subscriptions.

Expand All @@ -23,7 +21,7 @@ function doCallback() {
}

export function useSubscribe<R extends ReadonlyJSONValue>(
rep: Subscribable | null | undefined,
rep: Replicache | null | undefined,
query: (tx: ReadTransaction) => Promise<R>,
def: R,
deps: Array<unknown> = [],
Expand Down