mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-11 07:56:50 +02:00
fix: resolve 'Save & Publish' failures for spells and spellbooks
- Ensure SaveSpellbookDialog passes content to PublishSpellbookAction - Refactor SpellDialog to use PublishSpellAction instead of manual logic - Ensure published events are added to local EventStore for immediate UI update - Clean up unused imports and variables in SpellDialog
This commit is contained in:
@@ -8,6 +8,7 @@ import { SpellEvent } from "@/types/spell";
|
||||
import { relayListCache } from "@/services/relay-list-cache";
|
||||
import { AGGREGATOR_RELAYS } from "@/services/loaders";
|
||||
import { mergeRelaySets } from "applesauce-core/helpers";
|
||||
import eventStore from "@/services/event-store";
|
||||
|
||||
export class PublishSpellAction {
|
||||
type = "publish-spell";
|
||||
@@ -71,6 +72,9 @@ export class PublishSpellAction {
|
||||
|
||||
await pool.publish(relays, event);
|
||||
|
||||
// Add to event store for immediate availability
|
||||
eventStore.add(event);
|
||||
|
||||
await markSpellPublished(spell.id, event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AGGREGATOR_RELAYS } from "@/services/loaders";
|
||||
import { mergeRelaySets } from "applesauce-core/helpers";
|
||||
import { GrimoireState } from "@/types/app";
|
||||
import { SpellbookContent } from "@/types/spell";
|
||||
import eventStore from "@/services/event-store";
|
||||
|
||||
export interface PublishSpellbookOptions {
|
||||
state: GrimoireState;
|
||||
@@ -71,6 +72,9 @@ export class PublishSpellbookAction {
|
||||
// 4. Publish
|
||||
await pool.publish(relays, event);
|
||||
|
||||
// Add to event store for immediate availability
|
||||
eventStore.add(event);
|
||||
|
||||
// 5. Mark as published in local DB
|
||||
if (localId) {
|
||||
await markSpellbookPublished(localId, event);
|
||||
|
||||
Reference in New Issue
Block a user