Skip to content

Conversation

@DarianM
Copy link
Member

@DarianM DarianM commented Dec 22, 2025

Closes #479

Requested Changes

Reduce boilerplate, enforces consistent modal pattern and improves maintainability by centralizing modal control

  • modal management into a single DialogProvider using react context
  • DialogProvider mounts once at the app root and renders the active dialog based on context state
  • cleanup widget, banner and banner-two of modals
  • memoized context values to prevent unnecessary re-renders

Custom hooks for modal logic:

  • useSaveResultModal - encapsulates save result
  • useGrantResponseHandler - appropriate success/error modals after grant response flow after wallet ownership verification

Note to reviewer: the internal logic and state of individual modal types remain unchanged; only the orchestration and rendering approach has been unified.

@github-actions
Copy link

github-actions bot commented Dec 22, 2025

Deployment results

Worker Alias URL Outcome
API - staging success
CDN - staging success
App - 671faf58 success

Logs #20718838710

@DarianM DarianM requested a review from sidvishnoi December 22, 2025 21:22
@DarianM DarianM linked an issue Dec 22, 2025 that may be closed by this pull request
5 tasks
@DarianM DarianM requested a review from sidvishnoi December 24, 2025 14:29
Comment on lines 31 to 42
try {
await toolActions.saveConfig(toolState.lastSaveAction)
showSaveResult(toolState.lastSaveAction)
} catch (err) {
const error = err as Error
// @ts-expect-error TODO: type error.cause properly
const fieldErrors = error.cause?.details?.errors?.fieldErrors
showSaveResult(toolState.lastSaveAction, {
message: error.message,
fieldErrors
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part seems to be creeping in here. Why grant response need to care about saving? Saving requires grant success, but grant success shouldn't have to know about saving.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use onGrantSuccess something prop.

@DarianM DarianM requested a review from sidvishnoi December 31, 2025 00:18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many changes to this file seem like bug fixes, beyond this modal refactor work. Can you split them as separate PR (after or before this PR)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do 1-2 smaller PRs before this one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's see #497 before this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me create yet another PR to pull the simplified DialogProvider changes

)
}

export const useSaveResultModal = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it shouldn't belong to this file.

Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presently can't save config from banner-two route, but the modals work well.

Image

@DarianM
Copy link
Member Author

DarianM commented Jan 5, 2026

I presently can't save config from banner-two route, but the modals work well.

will take care of this further next by creating a new save one-profile-at-a-time route API that uses the new profile type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Simplify modal components structure and usage

3 participants