feat: Remove legacy files and fix first svelte/no-at-html-tags error\n\n- Moved legacy files from src/routes/legacy to backups/legacy/src/routes/legacy.\n- Removed the empty src/routes/legacy directory.\n- Fixed a svelte/no-at-html-tags error in src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte by replacing '{@html ?.name ?? 'Archive'}' with '{?.name ?? 'Archive'}'.\n- Addressed a misidentified '{@html}' tag in src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte by removing commented-out code that might have caused false positives.
This commit is contained in:
23
GEMINI.md
23
GEMINI.md
@@ -43,10 +43,9 @@ The following directories are ignored for various operations (e.g., search, file
|
||||
This project uses Svelte v5 with runes enabled. This introduces significant differences from Svelte v4. It is critical to adhere to v5 conventions to avoid bugs.
|
||||
|
||||
- **Reactivity:** State is managed with `$state` and `$derived`. Props can be made two-way bindable with `$bindable`. Avoid direct mutation of props.
|
||||
- **Event Handling:**
|
||||
- DOM events still use the `on:eventname` directive (e.g., `on:click`, `on:input`).
|
||||
- Component events are dispatched with `createEventDispatcher` and listened to with `on:eventname`.
|
||||
- For two-way binding on component props, use `bind:propName`.
|
||||
- **Event Handling (Updated 2025-11-20):**
|
||||
- **DOM Events:** Use the lowercase `onevent` attribute (e.g., `onclick`, `oninput`). Event modifiers like `|preventDefault` may not work as expected; handle prevention logic inside the function (e.g., `event.preventDefault()`).
|
||||
- **Component Events:** Continue to use the `on:eventname` directive for events dispatched from child components.
|
||||
- **Stores and `liveQuery`:**
|
||||
- To access the value of a store in Svelte v5, you must use the `$store_name` syntax (e.g., `$ae_api`).
|
||||
- Dexie `liveQuery` returns an observable. To use it in a component, you must subscribe to it within `onMount` to avoid SSR errors. The value from the subscription should then be assigned to a `$state` variable.
|
||||
@@ -61,6 +60,20 @@ This project uses Svelte v5 with runes enabled. This introduces significant diff
|
||||
|
||||
## Refactoring Notes
|
||||
|
||||
### Data Fetching & Processing Pattern (2025-11-20)
|
||||
|
||||
A standard pattern for fetching, processing, and caching data has been established to ensure consistency and separation of concerns.
|
||||
|
||||
1. **API Function (`load_*`, `search_*`, etc.):** This function is responsible for interacting with the API. It takes parameters needed for the API call (e.g., `event_id`, search strings).
|
||||
2. **Data Processor (`process_ae_obj__*_props`):** The API function's results are immediately passed to this dedicated processor function for the specific object type.
|
||||
- The API function MUST pass any necessary contextual data (like a parent `event_id`) to the processor.
|
||||
- The processor is responsible for all data shaping and enrichment before the data is cached.
|
||||
3. **Handling API Inconsistencies:** The processor is the designated location for handling any inconsistencies in the data returned by the API.
|
||||
- **Example (`event_badge`):** The `search__event_badge` API endpoint does not include the `event_id` in its results. The `process_ae_obj__event_badge_props` function now accepts the `event_id` as a parameter and injects it into each badge object before it's saved. This centralizes the fix and keeps the API-calling function clean.
|
||||
4. **Database Caching (`db_save_ae_obj_li__ae_obj`):** After processing, the clean and consistent data is passed to the generic `db_save` function to be cached in IndexedDB.
|
||||
|
||||
This pattern isolates API logic from data shaping logic, making the code more modular, predictable, and easier to debug.
|
||||
|
||||
### `process_ae_obj__*_props()` Refactoring (2025-11-13)
|
||||
|
||||
The `process_ae_obj__*_props()` family of functions, which are responsible for transforming API data for frontend use, have been refactored to standardize their structure and improve maintainability.
|
||||
@@ -137,8 +150,6 @@ A new event settings page was created at `/events/[event_id]/settings` to provid
|
||||
|
||||
To address issues with the Aether API's strict handling of `POST` and `PATCH` request payloads, a more robust solution for cleaning data on the frontend has been implemented.
|
||||
|
||||
**Key aspects of the changes:**
|
||||
|
||||
- **Svelte 5 Event Handlers:** Corrected the use of `on:click` to `onclick` in the event settings components to align with Svelte 5 conventions.
|
||||
- **Payload Cleaning:**
|
||||
- The `update_ae_obj__event` function in `src/lib/ae_events/ae_events__event.ts` was modified to remove read-only fields (`id`, `event_id`, `created_on`, `updated_on`, etc.) from the payload before sending it to the API.
|
||||
|
||||
Reference in New Issue
Block a user