Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: proposal status reactive display on register (#5437)
* feat: adds proposal status polling logic * chore: change proposals status to proposals state * fix: reactively add/remove proposals * chore: renames * fix: add optional chaining * fix: add void to properly handle promise return Co-authored-by: Jean Ribeiro <iamjeanribeiro@gmail.com> Co-authored-by: Matthew Maxwell <44885822+maxwellmattryan@users.noreply.github.com>
- Loading branch information
1 parent
518c0f2
commit d520cb3
Showing
7 changed files
with
48 additions
and
31 deletions.
There are no files selected for viewing
13 changes: 9 additions & 4 deletions
13
packages/desktop/views/dashboard/governance/views/ProposalsView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './proposals-state.store' | ||
export * from './registered-event-ids.store' | ||
export * from './selected-proposal.store' |
3 changes: 3 additions & 0 deletions
3
packages/shared/lib/core/governance/stores/registered-event-ids.store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { writable } from 'svelte/store' | ||
|
||
export const registeredEventIds = writable<string[]>([]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
packages/shared/lib/core/profile-manager/api/deregisterParticipationEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { get } from 'svelte/store' | ||
import type { EventId } from '@iota/wallet' | ||
import { removeProposalState } from '@core/governance' | ||
import { registeredEventIds, removeProposalState } from '@core/governance' | ||
import { profileManager } from '../stores' | ||
|
||
export function deregisterParticipationEvent(eventId: EventId): Promise<void> { | ||
export async function deregisterParticipationEvent(eventId: EventId): Promise<void> { | ||
const manager = get(profileManager) | ||
await manager.deregisterParticipationEvent(eventId) | ||
|
||
registeredEventIds.update((ids) => ids.filter((id) => id !== eventId)) | ||
removeProposalState(eventId) | ||
return manager.deregisterParticipationEvent(eventId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/shared/lib/core/profile-manager/api/registerParticipationEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { addProposalState } from '@core/governance' | ||
import { addProposalState, registeredEventIds } from '@core/governance' | ||
import { profileManager } from '@core/profile-manager/stores' | ||
import type { Event, EventId, Node } from '@iota/wallet' | ||
import { get } from 'svelte/store' | ||
|
||
export async function registerParticipationEvent(eventId: EventId, nodes: Node[]): Promise<Event> { | ||
const manager = get(profileManager) | ||
const event = await manager.registerParticipationEvent(eventId, nodes) | ||
|
||
registeredEventIds.update((ids) => [...ids, eventId]) | ||
await addProposalState(eventId) | ||
return event | ||
} |