fix: attach calendar color to created/updated events for cache + frontend
Events created or updated via the API were missing the calendar's backgroundColor, causing them to render without their provider color. v1.72.1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
08959c6ddb
commit
e1190a8fe6
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "my-weekly-todo-list",
|
"name": "my-weekly-todo-list",
|
||||||
"version": "1.72.0",
|
"version": "1.72.1",
|
||||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -76,6 +76,14 @@ export async function POST(request: NextRequest) {
|
|||||||
attachments,
|
attachments,
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
|
// Attach calendar color from connection metadata for cache + frontend
|
||||||
|
if (!event.backgroundColor && connection.calendars) {
|
||||||
|
const cal = (connection.calendars as any[]).find((c: any) => c.id === calendarId);
|
||||||
|
if (cal?.backgroundColor || cal?.color) {
|
||||||
|
event.backgroundColor = cal.backgroundColor || cal.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update cache - await to ensure it's ready before client refreshes
|
// Update cache - await to ensure it's ready before client refreshes
|
||||||
try {
|
try {
|
||||||
await upsertCachedEvent(userId, connection.id, connection.provider, event);
|
await upsertCachedEvent(userId, connection.id, connection.provider, event);
|
||||||
@ -144,6 +152,14 @@ export async function PATCH(request: NextRequest) {
|
|||||||
attachments,
|
attachments,
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
|
// Attach calendar color from connection metadata for cache + frontend
|
||||||
|
if (!event.backgroundColor && connection.calendars) {
|
||||||
|
const cal = (connection.calendars as any[]).find((c: any) => c.id === calendarId);
|
||||||
|
if (cal?.backgroundColor || cal?.color) {
|
||||||
|
event.backgroundColor = cal.backgroundColor || cal.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update cache - await to ensure it's ready before client refreshes
|
// Update cache - await to ensure it's ready before client refreshes
|
||||||
try {
|
try {
|
||||||
await upsertCachedEvent(userId, connection.id, connection.provider, event);
|
await upsertCachedEvent(userId, connection.id, connection.provider, event);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user