Refactor chat page useEffect organization and improve compose intent handling
Reorganizes useEffect hooks in chat/page.tsx to follow a helper-functions-first structure, improving readability and maintainability. Adds error handling and user feedback for compose intent, preventing UI flash while processing. In send/route.ts, ensures remote user handles are fully qualified and adds debug logging. Temporarily disables key caching in keys/route.ts to address development key mismatches.
This commit is contained in:
@@ -114,11 +114,18 @@ export async function POST(request: NextRequest) {
|
||||
});
|
||||
|
||||
if (!registryEntry) {
|
||||
console.error('Recipient DID not found in registry:', recipientDid);
|
||||
return NextResponse.json({ error: 'Recipient not found in registry' }, { status: 404 });
|
||||
}
|
||||
|
||||
const targetDomain = registryEntry.nodeDomain;
|
||||
const targetHandle = registryEntry.handle; // e.g. user@domain
|
||||
// Ensure handle is fully qualified for remote users
|
||||
let targetHandle = registryEntry.handle;
|
||||
if (!targetHandle.includes('@') && targetDomain) {
|
||||
targetHandle = `${targetHandle}@${targetDomain}`;
|
||||
}
|
||||
|
||||
console.log(`[Remote Send] Sending to ${targetHandle} at ${targetDomain}`);
|
||||
|
||||
// 2. Prepare Payload
|
||||
const messageData = {
|
||||
|
||||
Reference in New Issue
Block a user