reactive/data-client / .agents/skills/data-client-v0.19-migration
data-client-v0.19-migration
VerifiedUpgrade apps that already use @data-client to v0.19. Runs the v0.19 codemod, then fixes what it flags and what it can't see. Use when bumping @data-client packages to 0.19, or when Controller.fetchIfStale(), custom Managers or the managers prop break after upgrading. Not for adopting Data Client for the first time.
evals/files/chat-app/src/managers/LiveManager.ts
View on GitHubimport type { Manager, Middleware } from '@data-client/react';
import { actionTypes } from '@data-client/react';
import { Message, MessageResource } from '../resources';
/** Pushes new messages from the server into the store, and tells the server what we sent. */
export default class LiveManager implements Manager {
protected socket?: WebSocket;
// ids of messages this store has already received
protected received = new Set<string>();
constructor(protected url: string) {}
getMiddleware = (): Middleware => controller => {
this.socket = new WebSocket(this.url);
this.socket.onmessage = event => {
const message: Message = JSON.parse(event.data);
if (this.received.has(message.id)) return;
this.received.add(message.id);
controller.set(Message, { id: message.id }, message);
};
return next => async action => {
if (
action.type === actionTypes.SET_RESPONSE &&
action.endpoint === MessageResource.getList.push
) {
this.socket!.send(JSON.stringify({ type: 'sent', key: action.key }));
}
return next(action);
};
};
cleanup() {
this.socket?.close();
this.received.clear();
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |