Skip to content

fix(webhooks): normalize Poracle Pokemon payloads#1204

Open
Mygod wants to merge 31 commits intodevelopfrom
fix-poracle
Open

fix(webhooks): normalize Poracle Pokemon payloads#1204
Mygod wants to merge 31 commits intodevelopfrom
fix-poracle

Conversation

@Mygod
Copy link
Copy Markdown
Collaborator

@Mygod Mygod commented Apr 3, 2026

Summary

This fixes the ReactMap Poracle Pokemon alert flow so create and edit requests send the correct payload shape without leaking UI-only state.

What changed

  • split local Pokemon UI state from the payload sent to Poracle
  • use a normalized create payload for add-new saves
  • use a normalized update payload for tracked alert edits
  • preserve uid on updates so existing Poracle rules are updated instead of duplicated
  • preserve ping and other editable Pokemon fields across create/edit flows
  • keep allForms handling stable when multiple forms of the same species are involved
  • avoid reusing stale temp state in a way that can turn creates into updates

Result

  • new Pokemon alerts no longer accidentally overwrite existing tracked rules
  • edited Pokemon alerts keep targeting the correct Poracle entry
  • PoracleWeb and the map stay aligned on the saved Pokemon rule state
  • default/full-range values are normalized consistently instead of leaking as noisy UI state

Testing

  • ./node_modules/.bin/eslint src/features/webhooks/services/Poracle.js src/features/webhooks/Manage.jsx src/features/webhooks/tiles/TrackedTile.jsx
  • yarn build

yarn build completed successfully with the existing offline locale-index fallback warning.

Notes

There is still a preexisting no-IV summary mismatch on develop: the advanced dialog preview can hide some no-IV range constraints even though they may still persist. That behavior was identified during review but is not introduced
by this branch.

@Mygod Mygod requested a review from Copilot April 3, 2026 03:49
@Mygod Mygod added the Bug Something isn't working label Apr 3, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR normalizes Poracle Pokemon webhook payloads so create/edit flows send the intended API shape (and avoid carrying UI-only state), while keeping the ReactMap-side state consistent for display/editing.

Changes:

  • Added explicit Poracle payload helpers (processPokemon, toLocalState, toUpdatePayload, toApiPayload) to separate local UI state from API payloads.
  • Updated the “add new” save flow to POST the normalized API payload while still appending a UI-friendly version into local state.
  • Updated tracked alert editing to prefill temp filters with defaults and POST a normalized update payload.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/features/webhooks/tiles/TrackedTile.jsx Prefill advanced temp filter state with defaults + use normalized update payload for edits.
src/features/webhooks/services/Poracle.js Introduces Pokemon-specific normalization and separate helpers for local vs update vs API payload shaping.
src/features/webhooks/Manage.jsx Uses normalized API payload for create POST while maintaining local UI-friendly state updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Mygod Mygod requested a review from Copilot April 3, 2026 04:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants