Fix all Kind 11125 write paths to preserve profile content JSON
Critical safety fix: 9 out of 12 Kind 11125 publish paths were hardcoding content: '' which would silently erase any structured content (daily missions data) stored in the profile event. Every write path that updates an existing profile now preserves the existing event content via profile.event.content instead of overwriting with empty string. Fixed locations: - useBlobbiOnboarding.ts: reroll preview (line 378) and adopt (476) - BlobbiHatchingCeremony.tsx: add egg to has[] (302) and mark onboarding done (501) - useBlobbiMigration.ts: legacy migration (190) - useBlobbonautProfileNormalization.ts: tag normalization (85) - BlobbiPage.tsx: auto-fix onboardingDone (547) and companion toggle (1183) - useBlobbiPurchaseItem.ts: shop purchase (89) The only two paths that still use content: '' are initial profile creation flows (useBlobbiOnboarding auto-create and BlobbiHatchingCeremony silent setup) where no previous event exists. The useClaimMissionReward path already uses mergeProfileContent for proper read-modify-write of the content JSON.
This commit is contained in:
@@ -188,7 +188,7 @@ export function useBlobbiMigration() {
|
||||
|
||||
const profileEvent = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: profile.event.content,
|
||||
tags: profileTags,
|
||||
});
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ export function BlobbiHatchingCeremony({
|
||||
|
||||
const updatedProfileEvent = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: currentProfile?.event.content ?? '',
|
||||
tags: updatedTags,
|
||||
});
|
||||
|
||||
@@ -499,7 +499,7 @@ export function BlobbiHatchingCeremony({
|
||||
});
|
||||
const profileEvent = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: currentProfile.event.content,
|
||||
tags: updatedTags,
|
||||
});
|
||||
updateProfileEvent(profileEvent);
|
||||
|
||||
@@ -376,7 +376,7 @@ export function useBlobbiOnboarding({
|
||||
|
||||
const profileEvent = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: profile.event.content,
|
||||
tags: updatedTags,
|
||||
});
|
||||
|
||||
@@ -474,7 +474,7 @@ export function useBlobbiOnboarding({
|
||||
|
||||
const profileEvent = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: profile.event.content,
|
||||
tags: updatedProfileTags,
|
||||
});
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ export function useBlobbiPurchaseItem(currentProfile: BlobbonautProfile | null)
|
||||
// Publish updated profile event
|
||||
const event = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: currentProfile.event.content,
|
||||
tags: updatedTags,
|
||||
});
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ export function useBlobbonautProfileNormalization({
|
||||
// Always publish to the NEW kind (11125), regardless of source kind
|
||||
const event = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: profile.event.content,
|
||||
tags: normalizedTags,
|
||||
});
|
||||
|
||||
|
||||
@@ -545,7 +545,7 @@ function BlobbiContent() {
|
||||
});
|
||||
publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: profile.event.content,
|
||||
tags: updatedTags,
|
||||
}).then(event => {
|
||||
updateProfileEvent(event);
|
||||
@@ -1181,7 +1181,7 @@ function BlobbiDashboard({
|
||||
|
||||
const event = await publishEvent({
|
||||
kind: KIND_BLOBBONAUT_PROFILE,
|
||||
content: '',
|
||||
content: profile.event.content,
|
||||
tags: updatedTags,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user