-
Notifications
You must be signed in to change notification settings - Fork 0
fix: stream-feeds-react-tutorial-related adjustments #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b67d982
0f7746f
5839850
74da2e8
7ccc0ce
04615b2
ebfe54e
61d700f
dd68f57
2556518
0fb7e97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| catalog: | ||
| "@types/react": ~19.1.0 | ||
| "@types/react-dom": ~19.1.0 | ||
| react: 19.1.0 | ||
| react-dom: 19.1.0 | ||
|
|
||
| checksumBehavior: update | ||
|
|
||
| compressionLevel: mixed | ||
|
|
||
| enableGlobalCache: false | ||
|
|
||
| initScope: stream-io | ||
|
|
||
| nodeLinker: node-modules | ||
|
|
||
| plugins: | ||
| - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | ||
| spec: "@yarnpkg/plugin-interactive-tools" | ||
| - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
| spec: "@yarnpkg/plugin-workspace-tools" | ||
| - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs | ||
| spec: "@yarnpkg/plugin-typescript" | ||
|
|
||
| yarnPath: .yarn/releases/yarn-3.5.0.cjs | ||
| yarnPath: .yarn/releases/yarn-4.12.0.cjs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| "packageManager": "[email protected]", | ||
| "main": "./dist/cjs/index.js", | ||
| "module": "./dist/es/index.mjs", | ||
| "types": "./dist/types/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/types/index.d.ts", | ||
|
|
@@ -13,7 +14,7 @@ | |
| }, | ||
| "import": "./dist/es/index.mjs", | ||
| "require": "./dist/cjs/index.js", | ||
| "default": "./dist/es/index.mjs" | ||
| "default": "./dist/cjs/index.js" | ||
| }, | ||
| "./react-bindings": { | ||
| "types": "./dist/types/bindings/react/index.d.ts", | ||
|
|
@@ -23,15 +24,14 @@ | |
| }, | ||
| "import": "./dist/es/react-bindings.mjs", | ||
| "require": "./dist/cjs/react-bindings.js", | ||
| "default": "./dist/es/react-bindings.mjs" | ||
| "default": "./dist/cjs/react-bindings.js" | ||
| } | ||
| }, | ||
| "types": "./dist/types/index.d.ts", | ||
| "license": "See license in LICENSE", | ||
| "scripts": { | ||
| "clean": "rimraf dist", | ||
| "start": "vite build --watch", | ||
| "build": "vite build", | ||
| "start": "yarn clean; concurrently 'vite build --watch' 'tsc -p tsconfig.lib.json --watch'", | ||
| "build": "yarn clean; concurrently 'vite build' 'tsc -p tsconfig.lib.json'", | ||
| "test": "vitest", | ||
| "test:unit": "vitest --exclude '__integration-tests__/**'", | ||
| "test-ci": "vitest --exclude '__integration-tests__/docs-snippets/**' --coverage", | ||
|
|
@@ -56,19 +56,18 @@ | |
| }, | ||
| "devDependencies": { | ||
| "@stream-io/node-sdk": "0.6.0", | ||
| "@types/react": "^19.1.8", | ||
| "@types/react": "catalog:", | ||
| "@vitest/coverage-v8": "3.2.4", | ||
| "concurrently": "^9.2.1", | ||
| "dotenv": "^16.4.5", | ||
| "human-id": "^4.1.1", | ||
| "react": "19.0.0", | ||
| "rimraf": "^6.0.1", | ||
| "typescript": "^5.8.3", | ||
| "vite": "^7.1.11", | ||
| "vite-plugin-dts": "^4.5.4", | ||
| "typescript": "^5.9.3", | ||
| "vite": "^7", | ||
| "vitest": "^3.2.4" | ||
| }, | ||
| "peerDependencies": { | ||
| "react": "^18 || ^19" | ||
| "react": "^17 || ^18 || ^19" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "react": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ import { | |
| disconnectActivityFromFeed, | ||
| isAnyFeedWatched, | ||
| } from '../feeds-client/active-activity'; | ||
| import type { GetCommentsRequest } from '@self'; | ||
| import type { GetCommentsRequest } from '../types'; | ||
| import { deepEqual } from '../utils/deep-equal'; | ||
|
|
||
| type GetActivityConfig = { | ||
|
|
@@ -164,7 +164,7 @@ export class ActivityWithStateUpdates { | |
| }) { | ||
| this.feed = connectActivityToFeed.call(this.feedsClient, { fid }); | ||
|
|
||
| this.feed.state.partialNext({ | ||
| this.feed?.state.partialNext({ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find the activity-with-state-updates.ts file
fd -t f "activity-with-state-updates.ts"
# List files in packages/feeds-client/src to confirm directory structure
fd -t f -e ts "." "packages/feeds-client/src" | head -20Repository: GetStream/stream-feeds-js Length of output: 1799 🏁 Script executed: #!/bin/bash
# Get the exact file path
find . -name "activity-with-state-updates.ts" -type f
# Read the file
if [ -f "packages/feeds-client/src/activity-with-state-updates/activity-with-state-updates.ts" ]; then
cat -n "packages/feeds-client/src/activity-with-state-updates/activity-with-state-updates.ts"
fiRepository: GetStream/stream-feeds-js Length of output: 6941 🏁 Script executed: #!/bin/bash
# Find and examine connectActivityToFeed implementation
fd -t f "active-activity.ts" "packages/feeds-client/src"
# Read the file
find . -name "active-activity.ts" -type f | xargs cat -nRepository: GetStream/stream-feeds-js Length of output: 1275 🏁 Script executed: #!/bin/bash
# Check if empty feeds arrays are ever valid/expected
rg -n "feeds.*\[\]|feeds\.length.*===.*0" packages/feeds-client/src --type ts -A 2 -B 2
# Check how activityResponse.feeds is used elsewhere
rg -n "\.feeds\[0\]|\.feeds\?" packages/feeds-client/src --type ts -B 2 -A 2
# Check if there are tests that cover empty feeds scenarios
fd -t f "\.test\.ts$" packages/feeds-client/src | xargs grep -l "feeds.*\[\]|empty.*feeds" 2>/dev/null
# Search for activity response type definition
fd -t f "models.*\.(ts|d\.ts)$" packages/feeds-client/src | head -5Repository: GetStream/stream-feeds-js Length of output: 10974 🏁 Script executed: #!/bin/bash
# Check the ActivityResponse type definition more carefully
grep -A 10 "export interface ActivityResponse" packages/feeds-client/src/gen/models/index.ts
# Check if there are any tests that validate the empty feeds scenario
grep -r "feeds.*\[\]" packages/feeds-client/src --include="*.test.ts" -B 3 -A 3
# Check if there's validation in getActivity or any API handlers
grep -n "feeds" packages/feeds-client/src/feeds-client/feeds-client.ts | head -20Repository: GetStream/stream-feeds-js Length of output: 5536 🏁 Script executed: #!/bin/bash
# Check if there's any validation or error handling around the feeds array access
grep -B 5 -A 10 "feeds\[0\]" packages/feeds-client/src/activity-with-state-updates/activity-with-state-updates.ts
# Check test file to see if there are tests for empty feeds scenarios
cat packages/feeds-client/src/activity-with-state-updates/activity-with-state-updates.test.ts | head -100Repository: GetStream/stream-feeds-js Length of output: 3862 🏁 Script executed: #!/bin/bash
# Let's check if there's any type safety that prevents undefined from being passed
grep -B 5 -A 10 "fid: string" packages/feeds-client/src/feeds-client/active-activity.ts
# Check if there's any validation in setFeed or error handling
grep -B 10 -A 15 "private setFeed" packages/feeds-client/src/activity-with-state-updates/activity-with-state-updates.ts
# Let's verify what happens when we split undefined
node -e "console.log(undefined.split(':'))" 2>&1 || echo "Error as expected"
# Check if there's any validation that ensures feeds is not empty
rg "feeds.length|feeds\?" packages/feeds-client/src/test-utils/response-generators.ts -A 2 -B 2Repository: GetStream/stream-feeds-js Length of output: 1494 Accessing If Add validation to ensure if (!activityResponse.feeds.length) {
throw new Error('Activity must belong to at least one feed');
}
this.setFeed({
fid: activityResponse.feeds[0],
initialState: activityResponse,
});🤖 Prompt for AI Agents |
||
| activities: [initialState], | ||
| }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed these to default to CommonJS, it's safer.