Skip to content

Commit

Permalink
fix trackingEffects bug when the first value could not be selected (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloomca authored Jun 4, 2024
1 parent fff0896 commit cf6fcdb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/combine-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function combineState(...states) {
// it is guaranteed that reading `state.getValue` will
// return the updated value
const updatedValue = states.map((state) => state.getValue());
combinedState.setValue(() => updatedValue);
combinedState.setValue(updatedValue);
});
});

Expand Down
2 changes: 2 additions & 0 deletions src/hooks/create-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ function createState<T>(
}

cb(newSelectedValue);
// update selected value
trackingEffect.selectedValue = newSelectedValue;
});

trackingIterators.forEach((trackingIterator) => {
Expand Down

0 comments on commit cf6fcdb

Please sign in to comment.