Title: feat(entities): Implement watch() method for live query subscriptions by guyofeck · Pull Request #86 · base44/javascript-sdk · GitHub
Open Graph Title: feat(entities): Implement watch() method for live query subscriptions by guyofeck · Pull Request #86 · base44/javascript-sdk
X Title: feat(entities): Implement watch() method for live query subscriptions by guyofeck · Pull Request #86 · base44/javascript-sdk
Description: Summary Add watch(options, callback) method to EntityHandler for live query subscriptions Returns snapshots of matching entities whenever the result set changes Add WatchSnapshot type with type ('added', 'modified', 'removed'), entities, and timestamp Add WatchOptions type for filter, sort, fields, limit configuration Add subscribeQuery/unsubscribeQuery socket events for server communication Usage const unsubscribe = base44.entities.Task.watch( { filter: { status: 'active', priority: 'high' }, sort: '-created_date', limit: 10 }, (snapshot) => { console.log(`Change type: ${snapshot.type}`); // 'added', 'modified', 'removed' console.log(`Entities:`, snapshot.entities); // Full array of matching entities setTasks(snapshot.entities); // Update UI state directly } ); // Later, clean up unsubscribe(); Changes src/modules/entities.ts: Add watch() method with local snapshot state management src/modules/entities.types.ts: Add WatchSnapshot, WatchOptions, WatchChangeType, WatchSnapshotCallback types src/utils/socket-utils.ts: Add subscribeQuery() for emitting subscribe/unsubscribe events Test plan All 142 tests pass 20 tests for watch() method in entities-watch.test.ts 10 tests for subscribeQuery() in socket-utils-subscribeQuery.test.ts Tests cover initial data fetch with snapshots Tests cover added/modified/removed change types from socket Tests cover sorting and limit application Tests cover error handling (invalid JSON, callback errors, fetch failures) Tests cover unsubscribe cleanup and duplicate prevention Depends on: Backend PRs #2894, #2895, #2896 Fixes #83 🤖 Generated with Claude Code
Open Graph Description: Summary Add watch(options, callback) method to EntityHandler for live query subscriptions Returns snapshots of matching entities whenever the result set changes Add WatchSnapshot type with type (&...
X Description: Summary Add watch(options, callback) method to EntityHandler for live query subscriptions Returns snapshots of matching entities whenever the result set changes Add WatchSnapshot type with type (&...
Opengraph URL: https://github.com/base44/javascript-sdk/pull/86
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3997ba21-1892-478f-9f7c-350457d85523 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B880:127DAD:118D707:17998F8:6A4C6FD6 |
| html-safe-nonce | 3c868abcb064465a96e8e63af8faa0e3de89e066bf8ebc8ab7807eced7545f6d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODgwOjEyN0RBRDoxMThENzA3OjE3OTk4Rjg6NkE0QzZGRDYiLCJ2aXNpdG9yX2lkIjoiNDMzODk2MzY2Mjg2MzM2NDA1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ee1a959f79ec219b1f1651907fdc7922b9581ada66f66ef819814e8b104b12d |
| hovercard-subject-tag | pull_request:3200969422 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/base44/javascript-sdk/pull/86/files |
| twitter:image | https://avatars.githubusercontent.com/u/18700436?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/18700436?s=400&v=4 |
| og:image:alt | Summary Add watch(options, callback) method to EntityHandler for live query subscriptions Returns snapshots of matching entities whenever the result set changes Add WatchSnapshot type with type (&... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/base44/javascript-sdk git https://github.com/base44/javascript-sdk.git |
| octolytics-dimension-user_id | 234699998 |
| octolytics-dimension-user_login | base44 |
| octolytics-dimension-repository_id | 939374418 |
| octolytics-dimension-repository_nwo | base44/javascript-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 939374418 |
| octolytics-dimension-repository_network_root_nwo | base44/javascript-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width