feat(core): Expose ctx.playerID in onMove hook#1019
Merged
Conversation
This makes it possible to identify which player carried out the move and possiblt act on it (e.g. moving player to different stage). Closes boardgameio#1018
delucis
approved these changes
Oct 16, 2021
Member
delucis
left a comment
There was a problem hiding this comment.
Looks good to me!
(That TS error is definitely not related to these changes. I’m guessing somehow you overrode the package-lock and installed a more recent version of @types/koa, which now types query.)
ctx.playerID in onMove hook
delucis
added a commit
that referenced
this pull request
Nov 5, 2021
Addresses a regression introduced in #1019, which passed a stale version of `ctx` when calling `onMove` hooks. This was particularly noticeable if the move triggered the end of a player’s stage, which the `onMove` hook would then not see.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes #1018 by adding
playerIDto thectxused in theonMovehook.When setting up my local environment, some tests failed on main - it looks like it is related to TypeScript,
api.tsand possibly koa somehow 🤔 Attaching example output from a failed testIn order to create this PR, I pushed the branch with
--no-verify, hence the WIP prefix 😬Checklist
main).