fix(data_store): implement hierarchical priority logic in liveQuery; update project plans
This commit is contained in:
52
TODO.md
52
TODO.md
@@ -29,28 +29,33 @@ This is a list of tasks to be completed before the next event/show/conference.
|
||||
- [x] **Session Search:** Modernized logic, fixed layout bugs and icon exports. (Completed 2026-01-27)
|
||||
- [x] **Exhibit Search:** Standardized Exhibitor and Lead Tracking reactive search. (Completed 2026-01-28)
|
||||
|
||||
## Urgent Tasks (Feb 5, 2026)
|
||||
## Urgent Tasks (Feb 9, 2026)
|
||||
|
||||
1. **IDAA Module Verification:**
|
||||
- [ ] **Bulletin Board (BB):**
|
||||
- [ ] **Bulletin Board (BB):** 90-95% Ready for Beta Test.
|
||||
- [x] Verify Post/Comment create/edit (Resolved IntegrityErrors).
|
||||
- [ ] **STALLED:** Verify email notifications for staff and original posters (Confirmed NOT working).
|
||||
- [x] Loading Optimization: Simplified `+page.ts` fetches.
|
||||
- [ ] Verify anonymous toggle and hide/priority admin flags.
|
||||
- [ ] Test file attachments on Posts and optimize inline image display.
|
||||
- [ ] **Loading Optimization:** Simplify `+page.ts` post loading context to eliminate redundant fetches.
|
||||
- [ ] Test file attachments on Posts.
|
||||
- [x] **Archives:** Tested and working well. (Completed 2026-02-09)
|
||||
- [ ] **Recovery Meetings:**
|
||||
- [ ] Verify all search filters.
|
||||
- [ ] Audit full editing workflow (70% done).
|
||||
- [ ] Verify special code/copy buttons for Zoom/Jitsi.
|
||||
- [ ] **View and Edit:** View and Edit of an IDAA Recovery Meeting still needs to be fully tested.
|
||||
|
||||
2. **Events - Presentation Management:**
|
||||
- [ ] **Basics:** Ensure all core presentation management features are fully functional.
|
||||
- [ ] **Uploads:** Verify direct file uploads to Presenter, Session, Location, and Event.
|
||||
|
||||
3. **Events - Badges:**
|
||||
2. **Events - Badges:** Partially editable; needs full field implementation.
|
||||
- [ ] **Rendering:** Verify Badge Template pulling and correct rendering.
|
||||
- [ ] **Editing:** Ensure basic fields (name, affiliations, badge type) are editable.
|
||||
- [ ] **Editing:** Convert manual `editable_` fields and placeholders to `Element_ae_crud_v2` for robust field editing (Full Name, Title, Affiliations, etc.).
|
||||
|
||||
3. **Events - Leads/Tracking:** 80-90% done; ready for demo. (Pausing until later this week/next week)
|
||||
|
||||
4. **Framework - WebSockets:**
|
||||
- [ ] **Migration:** Update `element_websocket_v2.svelte` to V3 standards (Svelte 5 Runes, robust reconnection, and V3 API alignment).
|
||||
- [x] **Authentication:** Staff Passcode / Licensee Sign-in.
|
||||
- [x] **Portal Management:** Admin Tools & Licensee sync.
|
||||
- [x] **Sync Telemetry:** Refresh indicators.
|
||||
- [ ] **Stripe Integration:** Payment flow verification.
|
||||
- [ ] **Attendee Opt-in:** Verify logic.
|
||||
|
||||
## Urgent Tasks (Feb 4, 2026)
|
||||
|
||||
@@ -82,12 +87,13 @@ This is a list of tasks to be completed before the next event/show/conference.
|
||||
|
||||
---
|
||||
|
||||
## Current Priorities (Feb 3, 2026)
|
||||
## Current Priorities (Feb 9, 2026)
|
||||
|
||||
1. **Codebase Hygiene:**
|
||||
- [ ] **CRUD v2 Review:** Perform a comprehensive review/enhancement of 'Element_ae_crud_v2.svelte' (Mobile accessibility, 'Select' mode, workflow optimization).
|
||||
- [ ] **Type Mismatch Resolution:** Resolve remaining simple type mismatches flagged by `svelte-check` (currently ~160).
|
||||
- [ ] **Bite-Sized Refactoring:** Split large components (>800 lines) into modular sub-components (e.g., `ae_idaa_comp__event_obj_id_edit.svelte`).
|
||||
1. **Framework Hardening:**
|
||||
- [ ] **CRUD v2 Refactor:** Implement the refactor plan for `Element_ae_crud_v2.svelte` (V3 API alignment, Svelte 5 Runes, Mobile accessibility).
|
||||
- [x] **Project Plan:** Created formal strategy in `documentation/PROJECT_AE_OBJECT_FIELD_EDITOR_V3_UPGRADE.md`.
|
||||
- [ ] **Type Mismatch Resolution:** Resolve remaining simple type mismatches flagged by `svelte-check` (currently ~230).
|
||||
- [ ] **Bite-Sized Refactoring:** Split large components (>800 lines) into modular sub-components.
|
||||
2. **Reactivity & Performance:**
|
||||
- [x] **Search Guard Pattern:** Deployed project-wide to eliminate infinite loops.
|
||||
- [x] **Shared Observables:** Refactored lists to accept `liveQuery` props for flicker-free SWR transitions.
|
||||
@@ -118,6 +124,18 @@ This is a list of tasks to be completed before the next event/show/conference.
|
||||
- [x] **Compiler Error Resolution:** Fixed 40+ critical errors including duplicate attributes in multi-line tags and missing `untrack` imports in Svelte 5 effects.
|
||||
- [x] **Hosted Files Modernization:** Standardized all download, link, and upload components across the platform.
|
||||
|
||||
## Recent Accomplishments (Feb 9, 2026)
|
||||
|
||||
- **IDAA Module Validation:**
|
||||
- [x] **Archives:** Fully validated as working well; verified media loading, playback, and linked file management.
|
||||
- [x] **Bulletin Board (BB):** Reached 95% readiness for beta testing; optimized data loading and verified core post/comment workflows.
|
||||
- **Exhibitor Leads Module (V3):**
|
||||
- [x] **Standardization:** Completed naming alignment across library and routes (e.g., `load_ae_obj_id__event_exhibit`).
|
||||
- [x] **Rich Text Integration:** Implemented TipTap support for booth descriptions and exhibitor notes.
|
||||
- [x] **Readiness:** Module verified at 80-90% completion and ready for demonstration.
|
||||
- **Refactoring Tooling:**
|
||||
- [x] **Strategic Planning:** Added DX task to evaluate and implement robust CLI symbol renaming tools to reduce refactoring toil.
|
||||
|
||||
## Recent Accomplishments (Feb 8, 2026)
|
||||
|
||||
- **Exhibitor Leads Module (V3 Completion):**
|
||||
|
||||
49
documentation/PROJECT_AE_OBJECT_FIELD_EDITOR_V3_UPGRADE.md
Normal file
49
documentation/PROJECT_AE_OBJECT_FIELD_EDITOR_V3_UPGRADE.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Project Plan: Aether CRUD v2 Component Refactor (V3 Alignment)
|
||||
|
||||
> **Status:** Draft / Initial Planning
|
||||
> **Date:** February 9, 2026
|
||||
> **Target Component:** `src/lib/elements/element_ae_crud_v2.svelte`
|
||||
|
||||
## 1. Overview
|
||||
The `Element_ae_crud_v2` component is the central property editor for the Aether platform. Following major backend (FastAPI V3) and frontend (Svelte 5) upgrades, this component requires a systematic refactor to restore full functionality, improve performance, and enhance the developer experience (DX).
|
||||
|
||||
The goal is a **near drop-in replacement** that maintains the existing API while leveraging modern platform standards.
|
||||
|
||||
## 2. Strategic Objectives
|
||||
- **API Alignment:** Fully integrate with the V3 CRUD pattern (`PATCH /v3/crud/{obj_type}/{obj_id}`).
|
||||
- **Svelte 5 Optimization:** Migrate fully to Runes (`$state`, `$derived`, `$effect`, `$props`) for cleaner reactivity and improved prop-binding.
|
||||
- **Mobile-First UX:** Redesign the edit popover/form for better accessibility on smaller screens.
|
||||
- **Robust Error Handling:** Standardize error bubbling and validation feedback.
|
||||
- **Type Safety:** Ensure all props and internal state are strictly typed.
|
||||
|
||||
## 3. Current Version Audit (`v2`)
|
||||
- **Strengths:** Support for multiple field types (text, textarea, tiptap, select); SWR-ready via `object_reload`.
|
||||
- **Weaknesses:** Fragmented CSS; manual state synchronization logic; inconsistent button styling; limited feedback for patch failures.
|
||||
|
||||
## 4. Implementation Phases
|
||||
|
||||
### Phase 1: Core Reactivity & API
|
||||
- [ ] Replace `let` exports with `$props()` destructuring.
|
||||
- [ ] Implement `$state` for internal values and patch status.
|
||||
- [ ] Standardize the `handle_obj_field_patch` function to use the central `api.patch` helper.
|
||||
- [ ] Verify Triple-ID mapping within the component.
|
||||
|
||||
### Phase 2: UI/UX & Accessibility
|
||||
- [ ] Standardize Tailwind classes; remove legacy scope-polluting CSS.
|
||||
- [ ] Implement a "Select" mode optimized for mobile (Bottom Sheet style?).
|
||||
- [ ] Improve "Double Click to Edit" discoverability or provide a single-tap alternative for mobile.
|
||||
- [ ] Standardize button types (`type="button"`) and preset styles.
|
||||
|
||||
### Phase 3: Field Type Expansion
|
||||
- [ ] Enhance `select` mode with searchable dropdowns.
|
||||
- [ ] Formalize `tiptap` integration with full configuration support.
|
||||
- [ ] Add `datetime` and `date` field types.
|
||||
|
||||
### Phase 4: Verification & Migration
|
||||
- [ ] Create a testing playground route for CRUD v2.
|
||||
- [ ] Perform a surgical swap across high-traffic modules (Leads, Events, Journals).
|
||||
- [ ] Verify `npm run check` baseline.
|
||||
|
||||
## 5. Maintenance & Standards
|
||||
- Maintain the `object_reload={true}` pattern for automatic cache revalidation.
|
||||
- Ensure `class_li` and `display_block` props remain backward compatible.
|
||||
@@ -72,41 +72,36 @@
|
||||
if (log_lvl) console.log(`ae_e_data_store [${current_code}]: LQ Lookup...`, { account_id, current_for_type, current_for_id });
|
||||
|
||||
// Hierarchical Local Lookup (Specific -> Account -> Global)
|
||||
let result = null;
|
||||
|
||||
// 0. Code Only Lookup
|
||||
// NOTE: Why this works. There should only be one record per code in the *local* Dexie DB. This is correct in 99.9% of cases.
|
||||
if (log_lvl) console.log(`ae_e_data_store [${current_code}]: Trying Specific Code Lookup...`);
|
||||
result = await db_core.data_store
|
||||
// Mimics backend SQL priority: WHERE code = :code ORDER BY for_id DESC, account_id DESC
|
||||
if (log_lvl) console.log(`ae_e_data_store [${current_code}]: Fetching all matching codes for priority sorting...`);
|
||||
|
||||
const results = await db_core.data_store
|
||||
.where('code')
|
||||
.equals(current_code)
|
||||
.first();
|
||||
.toArray();
|
||||
|
||||
// // 1. Specific Lookup
|
||||
// if (current_for_type && current_for_id) {
|
||||
// result = await db_core.data_store
|
||||
// .where('[code+for_type+for_id]')
|
||||
// .equals([current_code, current_for_type, current_for_id])
|
||||
// .first();
|
||||
// }
|
||||
if (!results || results.length === 0) return null;
|
||||
|
||||
// // 2. Account Lookup
|
||||
// if (!result && account_id) {
|
||||
// result = await db_core.data_store
|
||||
// .where('[code+account_id+for_type]')
|
||||
// .equals([current_code, account_id, null])
|
||||
// .first();
|
||||
// }
|
||||
// Sort by specificity
|
||||
results.sort((a, b) => {
|
||||
// 1. Priority: Specific Context match (for_type + for_id)
|
||||
const a_context = (current_for_id && a.for_id === current_for_id && a.for_type === current_for_type) ? 1 : 0;
|
||||
const b_context = (current_for_id && b.for_id === current_for_id && b.for_type === current_for_type) ? 1 : 0;
|
||||
if (a_context !== b_context) return b_context - a_context;
|
||||
|
||||
// // 3. Global Lookup
|
||||
// if (!result) {
|
||||
// result = await db_core.data_store
|
||||
// .where('[code+account_id+for_type]')
|
||||
// .equals([current_code, null, null])
|
||||
// .first();
|
||||
// }
|
||||
// 2. Priority: Account-specific match
|
||||
const a_account = (account_id && a.account_id === account_id) ? 1 : 0;
|
||||
const b_account = (account_id && b.account_id === account_id) ? 1 : 0;
|
||||
if (a_account !== b_account) return b_account - a_account;
|
||||
|
||||
return result;
|
||||
// 3. Tie-breaker: Newest updated
|
||||
const a_time = new Date(a.updated_on || a.created_on || 0).getTime();
|
||||
const b_time = new Date(b.updated_on || b.created_on || 0).getTime();
|
||||
return b_time - a_time;
|
||||
});
|
||||
|
||||
if (log_lvl) console.log(`ae_e_data_store [${current_code}]: Best match found (ID: ${results[0].id}, Account: ${results[0].account_id})`);
|
||||
return results[0];
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user