Title: fix(rpc): honor automatic client caching by SaKaNa-Y · Pull Request #430 · devframes/devframe · GitHub
Open Graph Title: fix(rpc): honor automatic client caching by SaKaNa-Y · Pull Request #430 · devframes/devframe
X Title: fix(rpc): honor automatic client caching by SaKaNa-Y · Pull Request #430 · devframes/devframe
Description: ImportantPlease take a moment to read this. Thank you! I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not merge this PR until I have added it. You may also leave this PR unaddressed (because this means I have not fulfilled my responsibilities as the author). If my explanation is unclear or difficult to follow, please ask me to clarify or provide reproduction steps or supporting evidence. I welcome suggestions and counterarguments, especially questions about anything I may have overlooked. (Your feedback helps me learn and improve. 🙏) I hold myself to this standard for every PR, regardless of its size. Summary Enabling cacheOptions: true does not prevent repeated server execution for identical RPC calls. This affects static functions and queries declared with cacheable: true. The client creates a cache with an empty function list but never loads the server declarations. As a result, no function qualifies for automatic caching. This change lets the client request eligible function names from an authenticated server endpoint before sending a call. It then caches results by function name and arguments. Static functions and opted-in queries use the cache, while actions and events continue to execute. Explicit function lists and custom serializers remain supported. Same query, same arguments, two calls: Before: server executes twice After: server executes once; the second call returns the cached result The client clears cached results when declarations, connection status, or trust change, and when it closes. The server can also broadcast invalidation after data changes. Late responses cannot restore invalidated cache entries. Servers without the discovery endpoint continue to serve uncached calls. The change also handles timeouts while the client discovers cacheable functions. If invalidation triggers repeated discovery, expired calls stop before dispatch. This prevents an expired action from executing alongside a later retry. Calls already sent retain their existing timeout behavior. Failed discovery rejects waiting calls, and a later call retries discovery. Evidence These results come from the completed verification runs. Tests were not rerun for this description update. Browser reproduction: two identical calls execute twice with cacheOptions: true. An explicit function list returns the first result twice and executes the server function once. With the PR applied to the v1.2.3 source, all 28 cache regression tests pass. A separate consumer using the packed package passes all 46 checks across WebSocket and SSE. Coverage includes real authentication, disconnects, invalidation, late responses, discovery timeouts, and explicit cache lists. On that source plus the PR, lint, knip, typecheck, and build pass. The full test run reports 1686 passed, 13 skipped, and two failed export snapshots for @devframes/hub-ui-onboard. Both failures concern defaultMessages and also occur in the baseline CI run. Merge Danger Door: Two-way. This change can be reverted. Blast Radius: RPC caching. Automatic caching adds requests to discover eligible functions. Invalidation clears all cached results, including results cached through explicit function lists. The server must broadcast invalidation after changing data that cached queries read.
Open Graph Description: ImportantPlease take a moment to read this. Thank you! I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not...
X Description: ImportantPlease take a moment to read this. Thank you! I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not...
Opengraph URL: https://github.com/devframes/devframe/pull/430
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a47d0d76-101a-b1c3-2ad7-753c8cfa3859 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E8C6:18732E:159377D:1D7ADD4:6AFB7A5A |
| html-safe-nonce | 4eacbeedb8e4d031089362346f8f7734344eabd29341598100af2b2b24ef4951 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEM2OjE4NzMyRToxNTkzNzdEOjFEN0FERDQ6NkFGQjdBNUEiLCJ2aXNpdG9yX2lkIjoiNjk2Mzk5NDk1Nzc2MTQ0NDQ0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cebf525401f848625118b65181953cd5c499a83a83fd0254f79d4be39320dfee |
| hovercard-subject-tag | pull_request:4741019467 |
| 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/devframes/devframe/pull/430/files |
| twitter:image | https://avatars.githubusercontent.com/u/185575200?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/185575200?s=400&v=4 |
| og:image:alt | ImportantPlease take a moment to read this. Thank you! I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ef32892d4269fb87b55e81cc4ba8d86e0f16aa28446ffbf46cba8be5179ab188 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/devframes/devframe git https://github.com/devframes/devframe.git |
| octolytics-dimension-user_id | 279879373 |
| octolytics-dimension-user_login | devframes |
| octolytics-dimension-repository_id | 1231722386 |
| octolytics-dimension-repository_nwo | devframes/devframe |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1231722386 |
| octolytics-dimension-repository_network_root_nwo | devframes/devframe |
| 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 | bc3703b4dcbe820d1284ef63c88b001c850be25e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width