Compare commits

..

6 Commits

Author SHA1 Message Date
Guido D'Orsi
b62d75b847 Merge pull request #2149 from garden-co/changeset-release/main
Version Packages
2025-05-07 18:31:36 +02:00
github-actions[bot]
beafbd3088 Version Packages 2025-05-07 16:29:39 +00:00
Guido D'Orsi
653d8ba69f Merge pull request #2140 from garden-co/guido/rn-e2e-test
test: cover join chat in the rn e2e tests
2025-05-07 18:27:56 +02:00
Guido D'Orsi
6c23dab790 Merge pull request #2148 from garden-co/fix/autoload
fix(subscribe): fix error management and autoload on $each
2025-05-07 18:27:42 +02:00
Guido D'Orsi
80530a4065 fix(subscribe): fix error management and autoload on 2025-05-07 18:24:01 +02:00
Guido D'Orsi
a8466946d3 test: cover join chat in the rn e2e tests 2025-05-07 14:25:56 +02:00
91 changed files with 726 additions and 103 deletions

View File

@@ -1,5 +1,14 @@
# chat-rn-expo-clerk
## 1.0.111
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-expo@0.13.19
- jazz-react-native-media-images@0.13.19
## 1.0.110
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "chat-rn-expo-clerk",
"main": "index.js",
"version": "1.0.110",
"version": "1.0.111",
"scripts": {
"build": "expo export -p ios",
"start": "expo start",

View File

@@ -1,5 +1,13 @@
# chat-rn-expo
## 1.0.98
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-expo@0.13.19
## 1.0.97
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-rn-expo",
"version": "1.0.97",
"version": "1.0.98",
"main": "index.js",
"scripts": {
"build": "expo export -p ios",

View File

@@ -20,6 +20,7 @@ import { Chat, Message } from "./schema";
export default function ChatScreen({ navigation }: { navigation: any }) {
const { me, logOut } = useAccount();
const [chatId, setChatId] = useState<ID<Chat>>();
const [chatIdInput, setChatIdInput] = useState<string>();
const loadedChat = useCoState(Chat, chatId, { resolve: { $each: true } });
const [message, setMessage] = useState("");
const profile = useCoState(Profile, me._refs.profile?.id, {});
@@ -57,27 +58,11 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
};
const joinChat = () => {
Alert.prompt(
"Join Chat",
"Enter the Chat ID (example: co_zBGEHYvRfGuT2YSBraY3njGjnde)",
[
{
text: "Cancel",
style: "cancel",
},
{
text: "Join",
onPress: (chatId) => {
if (chatId) {
setChatId(chatId as ID<Chat>);
} else {
Alert.alert("Error", "Chat ID cannot be empty.");
}
},
},
],
"plain-text",
);
if (chatIdInput) {
setChatId(chatIdInput as ID<Chat>);
} else {
Alert.alert("Error", "Chat ID cannot be empty.");
}
};
const sendMessage = () => {
@@ -160,9 +145,25 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
>
<Text className="text-white font-semibold">Start new chat</Text>
</TouchableOpacity>
<Text className="text-m font-bold mt-6">Join existing chat</Text>
<TextInput
className="rounded h-12 p-2 m-2 mt-4 w-80 border border-gray-200 block"
placeholder="Chat ID"
value={chatIdInput ?? ""}
onChangeText={(value) => {
setChatIdInput(value);
}}
textAlignVertical="center"
onSubmitEditing={() => {
if (chatIdInput) {
setChatId(chatIdInput as ID<Chat>);
}
}}
testID="chat-id-input"
/>
<TouchableOpacity
onPress={joinChat}
className="bg-green-500 p-4 rounded-md mt-4"
className="bg-green-500 p-4 rounded-md"
>
<Text className="text-white font-semibold">Join chat</Text>
</TouchableOpacity>
@@ -172,7 +173,6 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
<FlatList
contentContainerStyle={{
flexGrow: 1,
flex: 1,
gap: 6,
padding: 8,
}}

View File

@@ -44,9 +44,11 @@ appId: com.jazz.chatrn
# logout
- tapOn: "Logout"
- assertVisible: "Anonymous user"
# This doesn't work on CI, maybe because Android has a different alert dialog
# - tapOn: "Join chat"
# - inputText: "co_zFs6KFyhxPw4xtw83tcEMzeHUNv" # Use a static id because maestro doesn't have access to the system clipboard
# - pressKey: "enter"
# - assertVisible: "boorad"
# - assertVisible: "bro, low key, it do be like that tho"
# join chat
- tapOn:
id: "chat-id-input"
- inputText: "co_zFs6KFyhxPw4xtw83tcEMzeHUNv" # Use a static id because maestro doesn't have access to the system clipboard
- tapOn: "Join chat"
- assertVisible: "boorad"
- assertVisible: "bro, low key, it do be like that tho"

View File

@@ -1,5 +1,13 @@
# chat-rn
## 1.0.106
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react-native@0.13.19
## 1.0.105
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-rn",
"version": "1.0.105",
"version": "1.0.106",
"main": "index.js",
"scripts": {
"android": "react-native run-android",

View File

@@ -1,5 +1,14 @@
# chat-vue
## 0.0.90
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
- jazz-vue@0.13.19
## 0.0.89
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-vue",
"version": "0.0.89",
"version": "0.0.90",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,14 @@
# jazz-example-chat
## 0.0.188
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-inspector@0.13.19
- jazz-react@0.13.19
## 0.0.187
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-chat",
"private": true,
"version": "0.0.187",
"version": "0.0.188",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# minimal-auth-clerk
## 0.0.87
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
- jazz-react-auth-clerk@0.13.19
## 0.0.86
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "clerk",
"private": true,
"version": "0.0.86",
"version": "0.0.87",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# file-share-svelte
## 0.0.70
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-svelte@0.13.19
## 0.0.69
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "file-share-svelte",
"version": "0.0.69",
"version": "0.0.70",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,14 @@
# jazz-tailwind-demo-auth-starter
## 0.0.27
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-inspector@0.13.19
- jazz-react@0.13.19
## 0.0.26
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "filestream",
"private": true,
"version": "0.0.26",
"version": "0.0.27",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# form
## 0.1.28
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.1.27
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "form",
"private": true,
"version": "0.1.27",
"version": "0.1.28",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# image-upload
## 0.0.84
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.83
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "image-upload",
"private": true,
"version": "0.0.83",
"version": "0.0.84",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,11 @@
# jazz-example-inspector
## 0.0.138
### Patch Changes
- jazz-inspector@0.13.19
## 0.0.137
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-inspector-app",
"private": true,
"version": "0.0.137",
"version": "0.0.138",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# multi-cursors
## 0.0.80
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.79
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "multi-cursors",
"private": true,
"version": "0.0.79",
"version": "0.0.80",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# multiauth
## 0.0.28
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
- jazz-react-auth-clerk@0.13.19
## 0.0.27
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "multiauth",
"private": true,
"version": "0.0.27",
"version": "0.0.28",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# jazz-example-musicplayer
## 0.0.109
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-inspector@0.13.19
- jazz-react@0.13.19
## 0.0.108
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-music-player",
"private": true,
"version": "0.0.108",
"version": "0.0.109",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# organization
## 0.0.80
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.79
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "organization",
"private": true,
"version": "0.0.79",
"version": "0.0.80",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# passkey-svelte
## 0.0.74
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-svelte@0.13.19
## 0.0.73
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "passkey-svelte",
"version": "0.0.73",
"version": "0.0.74",
"type": "module",
"private": true,
"scripts": {

View File

@@ -1,5 +1,13 @@
# minimal-auth-passkey
## 0.0.85
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.84
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "passkey",
"private": true,
"version": "0.0.84",
"version": "0.0.85",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# passphrase
## 0.0.82
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.81
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "passphrase",
"private": true,
"version": "0.0.81",
"version": "0.0.82",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# jazz-password-manager
## 0.0.106
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.105
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-password-manager",
"private": true,
"version": "0.0.105",
"version": "0.0.106",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# jazz-example-pets
## 0.0.204
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.203
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-pets",
"private": true,
"version": "0.0.203",
"version": "0.0.204",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# reactions
## 0.0.84
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.83
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "reactions",
"private": true,
"version": "0.0.83",
"version": "0.0.84",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# richtext
## 0.0.74
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
- jazz-richtext-prosemirror@0.1.8
## 0.0.73
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "richtext",
"private": true,
"version": "0.0.73",
"version": "0.0.74",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# todo-vue
## 0.0.88
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
- jazz-vue@0.13.19
## 0.0.87
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "todo-vue",
"version": "0.0.87",
"version": "0.0.88",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,13 @@
# jazz-example-todo
## 0.0.203
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.202
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-todo",
"private": true,
"version": "0.0.202",
"version": "0.0.203",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# version-history
## 0.0.82
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-inspector@0.13.19
- jazz-react@0.13.19
## 0.0.81
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "version-history",
"private": true,
"version": "0.0.81",
"version": "0.0.82",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# jazz-auth-clerk
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,14 +1,14 @@
{
"name": "jazz-auth-clerk",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"cojson": "workspace:0.13.18",
"jazz-browser": "workspace:0.13.18",
"jazz-tools": "workspace:0.13.18"
"jazz-browser": "workspace:0.13.19",
"jazz-tools": "workspace:0.13.19"
},
"scripts": {
"format-and-lint": "biome check .",

View File

@@ -1,5 +1,13 @@
# jazz-browser-media-images
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-browser-media-images",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -8,8 +8,8 @@
"dependencies": {
"@types/image-blob-reduce": "^4.1.1",
"image-blob-reduce": "^4.1.0",
"jazz-browser": "workspace:0.13.18",
"jazz-tools": "workspace:0.13.18",
"jazz-browser": "workspace:0.13.19",
"jazz-tools": "workspace:0.13.19",
"pica": "^9.0.1"
},
"scripts": {

View File

@@ -1,5 +1,12 @@
# jazz-browser
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-browser",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,15 @@
# jazz-browser
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-auth-clerk@0.13.19
- jazz-react-core@0.13.19
- jazz-react-native-core@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-expo",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",

View File

@@ -1,5 +1,13 @@
# jazz-inspector
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react-core@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-inspector",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "./dist/app.js",
"types": "./dist/app.d.ts",

View File

@@ -1,5 +1,12 @@
# jazz-autosub
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "dist/index.d.ts",
"type": "module",
"license": "MIT",
"version": "0.13.18",
"version": "0.13.19",
"dependencies": {
"cojson": "workspace:*",
"cojson-transport-ws": "workspace:*",

View File

@@ -1,5 +1,15 @@
# jazz-browser-media-images
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-auth-clerk@0.13.19
- jazz-browser@0.13.19
- jazz-react@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-react-auth-clerk",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,12 @@
# jazz-react-core
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-react-core",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,13 @@
# jazz-browser
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react-core@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-react-native-core",
"type": "module",
"version": "0.13.18",
"version": "0.13.19",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.js",

View File

@@ -1,5 +1,12 @@
# jazz-browser-media-images
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-react-native-media-images",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,13 @@
# jazz-browser
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react-native-core@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-react-native",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",

View File

@@ -1,5 +1,15 @@
# jazz-react
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
- jazz-browser-media-images@0.13.19
- jazz-react-core@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-react",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -18,10 +18,10 @@
"dependencies": {
"@scure/bip39": "^1.3.0",
"cojson": "workspace:0.13.18",
"jazz-browser-media-images": "workspace:0.13.18",
"jazz-browser": "workspace:0.13.18",
"jazz-react-core": "workspace:0.13.18",
"jazz-tools": "workspace:0.13.18"
"jazz-browser-media-images": "workspace:0.13.19",
"jazz-browser": "workspace:0.13.19",
"jazz-react-core": "workspace:0.13.19",
"jazz-tools": "workspace:0.13.19"
},
"devDependencies": {
"@testing-library/dom": "^10.4.0",

View File

@@ -1,5 +1,13 @@
# jazz-richtext-prosemirror
## 0.1.8
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
## 0.1.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-richtext-prosemirror",
"version": "0.1.7",
"version": "0.1.8",
"description": "ProseMirror integration for Jazz rich text editing",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,12 @@
# jazz-run
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -3,7 +3,7 @@
"bin": "./dist/index.js",
"type": "module",
"license": "MIT",
"version": "0.13.18",
"version": "0.13.19",
"exports": {
"./startSyncServer": {
"import": "./dist/startSyncServer.js",
@@ -31,7 +31,7 @@
"cojson-storage-sqlite": "workspace:0.13.18",
"cojson-transport-ws": "workspace:0.13.18",
"effect": "^3.6.5",
"jazz-tools": "workspace:0.13.18",
"jazz-tools": "workspace:0.13.19",
"ws": "^8.14.2"
},
"devDependencies": {

View File

@@ -1,5 +1,13 @@
# jazz-svelte
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-svelte",
"version": "0.13.18",
"version": "0.13.19",
"scripts": {
"dev": "vite dev",
"build": "vite build && npm run package",

View File

@@ -1,5 +1,11 @@
# jazz-tools
## 0.13.19
### Patch Changes
- 80530a4: Improve error management for autoloaded values and fix autoloading on $each resolve
## 0.13.18
### Patch Changes

View File

@@ -17,7 +17,7 @@
},
"type": "module",
"license": "MIT",
"version": "0.13.18",
"version": "0.13.19",
"dependencies": {
"@scure/bip39": "^1.3.0",
"cojson": "workspace:*",

View File

@@ -27,6 +27,7 @@ export class SubscriptionScope<D extends CoValue> {
resolve: RefsToResolve<any>;
idsSubscribed = new Set<string>();
autoloaded = new Set<string>();
autoloadedKeys = new Set<string>();
totalValidTransactions = 0;
silenceUpdates = false;
@@ -133,7 +134,12 @@ export class SubscriptionScope<D extends CoValue> {
return undefined;
}
for (const value of this.childErrors.values()) {
for (const [key, value] of this.childErrors.entries()) {
// We don't want to block updates if the error is on an autoloaded value
if (this.autoloaded.has(key)) {
continue;
}
errorType = value.type;
if (value.issues) {
issues.push(...value.issues);
@@ -147,7 +153,11 @@ export class SubscriptionScope<D extends CoValue> {
}
}
return new JazzError(this.id, errorType, issues);
if (issues.length) {
return new JazzError(this.id, errorType, issues);
}
return undefined;
}
handleChildUpdate = (
@@ -242,7 +252,10 @@ export class SubscriptionScope<D extends CoValue> {
return;
}
// Adding the key to the resolve object to resolve the key when calling loadChildren
this.resolve[key as keyof typeof this.resolve] = true;
// Track the keys that are autoloaded to flag any id on that key as autoloaded
this.autoloadedKeys.add(key);
if (this.value.type !== "loaded") {
return;
@@ -259,19 +272,11 @@ export class SubscriptionScope<D extends CoValue> {
if (value._type === "CoMap" || value._type === "Account") {
const map = value as CoMap;
const id = this.loadCoMapKey(map, key, true);
if (id) {
this.autoloaded.add(id);
}
this.loadCoMapKey(map, key, true);
} else if (value._type === "CoList") {
const list = value as CoList;
const id = this.loadCoListKey(list, key, true);
if (id) {
this.autoloaded.add(id);
}
this.loadCoListKey(list, key, true);
}
this.silenceUpdates = false;
@@ -504,10 +509,18 @@ export class SubscriptionScope<D extends CoValue> {
return;
}
if (key && this.autoloadedKeys.has(key)) {
this.autoloaded.add(id);
}
// Cloning the resolve objects to avoid mutating the original object when tracking autoloaded values
const resolve =
typeof query === "object" && query !== null ? { ...query } : query;
this.childValues.set(id, { type: "unloaded", id });
const child = new SubscriptionScope(
this.node,
query,
resolve,
id as ID<any>,
descriptor,
);

View File

@@ -937,6 +937,263 @@ describe("subscribeToCoValue", () => {
expect(value?.name).toBe("writer2");
expect(value?._raw.totalValidTransactions).toBe(2);
});
it("errors on autoloaded values shouldn't block updates", async () => {
class TestMap extends CoMap {
value = co.string;
}
class TestList extends CoList.Of(co.ref(TestMap)) {}
const reader = await createJazzTestAccount({
isCurrentActiveAccount: true,
});
const creator = await createJazzTestAccount({
isCurrentActiveAccount: true,
});
const everyone = Group.create(creator);
everyone.addMember("everyone", "reader");
const group = Group.create(creator);
const list = TestList.create(
[
TestMap.create({ value: "1" }, group),
TestMap.create({ value: "2" }, everyone),
TestMap.create({ value: "3" }, everyone),
TestMap.create({ value: "4" }, everyone),
TestMap.create({ value: "5" }, everyone),
],
everyone,
);
let result = null as Resolved<TestList, { $each: true }> | null;
const updateFn = vi.fn().mockImplementation((value) => {
result = value;
});
const onUnauthorized = vi.fn();
const onUnavailable = vi.fn();
const unsubscribe = subscribeToCoValue(
TestList,
list.id,
{
loadAs: reader,
resolve: true,
onUnauthorized,
onUnavailable,
},
updateFn,
);
onTestFinished(unsubscribe);
await waitFor(() => {
expect(updateFn).toHaveBeenCalled();
});
await waitFor(() => {
assert(result);
expect(result[1]?.value).toBe("2");
});
assert(result);
expect(result[0]).toBe(null);
updateFn.mockClear();
list[1] = TestMap.create({ value: "updated" }, everyone);
await waitFor(() => {
expect(result?.[1]?.value).toBe("updated");
});
expect(onUnavailable).not.toHaveBeenCalled();
expect(onUnauthorized).not.toHaveBeenCalled();
});
it("errors on autoloaded values shouldn't block updates, even when the error comes from a new ref", async () => {
class Dog extends CoMap {
name = co.string;
}
class Person extends CoMap {
name = co.string;
dog = co.ref(Dog);
}
class PersonList extends CoList.Of(co.ref(Person)) {}
const reader = await createJazzTestAccount({
isCurrentActiveAccount: true,
});
const creator = await createJazzTestAccount({
isCurrentActiveAccount: true,
});
const everyone = Group.create(creator);
everyone.addMember("everyone", "reader");
const list = PersonList.create(
[
Person.create(
{ name: "Guido", dog: Dog.create({ name: "Giggino" }, everyone) },
everyone,
),
Person.create(
{ name: "John", dog: Dog.create({ name: "Rex" }, everyone) },
everyone,
),
Person.create(
{ name: "Jane", dog: Dog.create({ name: "Bella" }, everyone) },
everyone,
),
],
everyone,
);
let result = null as Resolved<PersonList, { $each: true }> | null;
const updateFn = vi.fn().mockImplementation((value) => {
result = value;
});
const onUnauthorized = vi.fn();
const onUnavailable = vi.fn();
const unsubscribe = subscribeToCoValue(
PersonList,
list.id,
{
loadAs: reader,
resolve: {
$each: true,
},
onUnauthorized,
onUnavailable,
},
updateFn,
);
onTestFinished(unsubscribe);
await waitFor(() => {
expect(result?.[0]?.name).toBe("Guido");
expect(result?.[0]?.dog?.name).toBe("Giggino");
});
await waitFor(() => {
expect(result?.[1]?.name).toBe("John");
expect(result?.[1]?.dog?.name).toBe("Rex");
});
await waitFor(() => {
expect(result?.[2]?.name).toBe("Jane");
expect(result?.[2]?.dog?.name).toBe("Bella");
});
list[0]!.dog = Dog.create({ name: "Ninja" });
await waitFor(() => {
expect(result?.[0]?.dog).toBe(null);
});
list[1]!.dog = Dog.create({ name: "Pinkie" }, everyone);
await waitFor(() => {
expect(result?.[1]?.dog?.name).toBe("Pinkie");
});
expect(onUnavailable).not.toHaveBeenCalled();
expect(onUnauthorized).not.toHaveBeenCalled();
});
it("autoload on $each resolve should work on all items", async () => {
class Dog extends CoMap {
name = co.string;
}
class Person extends CoMap {
name = co.string;
dog = co.ref(Dog);
}
class PersonList extends CoList.Of(co.ref(Person)) {}
const reader = await createJazzTestAccount({
isCurrentActiveAccount: true,
});
const creator = await createJazzTestAccount({
isCurrentActiveAccount: true,
});
const everyone = Group.create(creator);
everyone.addMember("everyone", "reader");
const list = PersonList.create(
[
Person.create(
{ name: "Guido", dog: Dog.create({ name: "Giggino" }, everyone) },
everyone,
),
Person.create(
{ name: "John", dog: Dog.create({ name: "Rex" }, everyone) },
everyone,
),
Person.create(
{ name: "Jane", dog: Dog.create({ name: "Bella" }, everyone) },
everyone,
),
],
everyone,
);
let result = null as Resolved<PersonList, { $each: true }> | null;
const updateFn = vi.fn().mockImplementation((value) => {
result = value;
});
const onUnauthorized = vi.fn();
const onUnavailable = vi.fn();
const unsubscribe = subscribeToCoValue(
PersonList,
list.id,
{
loadAs: reader,
resolve: {
$each: true,
},
onUnauthorized,
onUnavailable,
},
updateFn,
);
onTestFinished(unsubscribe);
await waitFor(() => {
expect(result?.[0]?.name).toBe("Guido");
expect(result?.[0]?.dog?.name).toBe("Giggino");
});
await waitFor(() => {
expect(result?.[1]?.name).toBe("John");
expect(result?.[1]?.dog?.name).toBe("Rex");
});
await waitFor(() => {
expect(result?.[2]?.name).toBe("Jane");
expect(result?.[2]?.dog?.name).toBe("Bella");
});
expect(onUnavailable).not.toHaveBeenCalled();
expect(onUnauthorized).not.toHaveBeenCalled();
});
});
describe("createCoValueObservable", () => {

View File

@@ -1,5 +1,13 @@
# jazz-react
## 0.13.19
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-browser@0.13.19
## 0.13.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-vue",
"version": "0.13.18",
"version": "0.13.19",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

18
pnpm-lock.yaml generated
View File

@@ -1964,10 +1964,10 @@ importers:
specifier: workspace:0.13.18
version: link:../cojson
jazz-browser:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-browser
jazz-tools:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-tools
devDependencies:
typescript:
@@ -2005,10 +2005,10 @@ importers:
specifier: ^4.1.0
version: 4.1.0
jazz-browser:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-browser
jazz-tools:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-tools
pica:
specifier: ^9.0.1
@@ -2132,16 +2132,16 @@ importers:
specifier: workspace:0.13.18
version: link:../cojson
jazz-browser:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-browser
jazz-browser-media-images:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-browser-media-images
jazz-react-core:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-react-core
jazz-tools:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-tools
devDependencies:
'@testing-library/dom':
@@ -2409,7 +2409,7 @@ importers:
specifier: ^3.6.5
version: 3.11.9
jazz-tools:
specifier: workspace:0.13.18
specifier: workspace:0.13.19
version: link:../jazz-tools
ws:
specifier: ^8.14.2

View File

@@ -1,5 +1,13 @@
# jazz-tailwind-demo-auth-starter
## 0.0.81
### Patch Changes
- Updated dependencies [80530a4]
- jazz-tools@0.13.19
- jazz-react@0.13.19
## 0.0.80
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-tailwind-demo-auth-starter",
"private": true,
"version": "0.0.80",
"version": "0.0.81",
"type": "module",
"scripts": {
"dev": "vite",