Skip to content

Commit

Permalink
Merge pull request #293 from dataforgoodfr/fix/add-default-value-to-p…
Browse files Browse the repository at this point in the history
…ersonalization

Fix/add default value to personalization
  • Loading branch information
Baboo7 authored Jun 26, 2023
2 parents 01abd65 + f2bd23b commit c1c869e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ function useCurrentPlayer() {
),
[game.step, team.actions, productionActionById]
);
const personalization = useMemo(
() => player?.profile?.personalization || {},
[player?.profile?.personalization]
);

return {
player,
profile: player.profile,
personalization: player.profile.personalization,
personalization,
playerActions: player.actions,
actionPointsAvailableAtCurrentStep: STEPS[game.step].availableActionPoints,
teamActions: team.actions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export { usePersona };

function usePersona() {
const { consumptionActionById, game, productionActionById } = usePlay();
const { player, playerActions, teamActions } = useCurrentPlayer();

const personalization = player.profile.personalization;
const { personalization, playerActions, teamActions } = useCurrentPlayer();

const initialPersona = buildInitialPersona(
personalization,
Expand Down

0 comments on commit c1c869e

Please sign in to comment.