Fix QA findings: remove duplicate migration, formatting, static classNames
- Remove migration 054 (duplicate of 035 which already has all 3 indexes, including a superior partial index for starred events) - Fix handleEventDidMount indentation and missing semicolons - Replace eventClassNames arrow function with static UMBRA_EVENT_CLASSES array - Correct misleading subquery comment in dashboard.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e12687ca6f
commit
050e0c7141
@ -1,36 +0,0 @@
|
||||
"""Add performance indexes to calendar_events
|
||||
|
||||
Revision ID: 054
|
||||
Revises: 053
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
revision = "054"
|
||||
down_revision = "053"
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Covers range queries in dashboard today's events and events list
|
||||
op.create_index(
|
||||
"ix_calendar_events_calendar_start",
|
||||
"calendar_events",
|
||||
["calendar_id", "start_datetime"],
|
||||
)
|
||||
# Covers bulk DELETE on recurrence edit/regeneration and sibling lookups
|
||||
op.create_index(
|
||||
"ix_calendar_events_parent_event_id",
|
||||
"calendar_events",
|
||||
["parent_event_id"],
|
||||
)
|
||||
# Covers starred widget query (calendar_id + is_starred + start_datetime)
|
||||
op.create_index(
|
||||
"ix_calendar_events_calendar_starred_start",
|
||||
"calendar_events",
|
||||
["calendar_id", "is_starred", "start_datetime"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index("ix_calendar_events_calendar_starred_start", table_name="calendar_events")
|
||||
op.drop_index("ix_calendar_events_parent_event_id", table_name="calendar_events")
|
||||
op.drop_index("ix_calendar_events_calendar_start", table_name="calendar_events")
|
||||
@ -35,8 +35,8 @@ async def get_dashboard(
|
||||
today = client_date or date.today()
|
||||
upcoming_cutoff = today + timedelta(days=current_settings.upcoming_days)
|
||||
|
||||
# Fetch calendar IDs once as a plain list — PostgreSQL handles IN (1,2,3) more
|
||||
# efficiently than re-evaluating a correlated subquery for each of the 3 queries below.
|
||||
# Fetch calendar IDs once as a plain list — avoids repeating the subquery
|
||||
# expression in each of the 3+ queries below and makes intent clearer.
|
||||
calendar_id_result = await db.execute(
|
||||
select(Calendar.id).where(Calendar.user_id == current_user.id)
|
||||
)
|
||||
|
||||
@ -33,6 +33,8 @@ const viewLabels: Record<CalendarView, string> = {
|
||||
timeGridDay: 'Day',
|
||||
};
|
||||
|
||||
const UMBRA_EVENT_CLASSES = ['umbra-event'];
|
||||
|
||||
export default function CalendarPage() {
|
||||
const queryClient = useQueryClient();
|
||||
const location = useLocation();
|
||||
@ -551,7 +553,7 @@ export default function CalendarPage() {
|
||||
<span className="text-[10px] opacity-50 leading-tight tabular-nums">{arg.timeText}</span>
|
||||
</div>
|
||||
);
|
||||
}, [])
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
@ -708,7 +710,7 @@ export default function CalendarPage() {
|
||||
slotLabelFormat={{ hour: 'numeric', minute: '2-digit', meridiem: 'short' }}
|
||||
slotEventOverlap={false}
|
||||
eventDidMount={handleEventDidMount}
|
||||
eventClassNames={() => ['umbra-event']}
|
||||
eventClassNames={UMBRA_EVENT_CLASSES}
|
||||
eventContent={renderEventContent}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user