Skip to content

Add tests and improve new tasks typing#582

Open
correct-horse-battery-bench wants to merge 6 commits intohashtopolis:masterfrom
correct-horse-battery-bench:add-tests-and-improve-new-tasks-typing
Open

Add tests and improve new tasks typing#582
correct-horse-battery-bench wants to merge 6 commits intohashtopolis:masterfrom
correct-horse-battery-bench:add-tests-and-improve-new-tasks-typing

Conversation

@correct-horse-battery-bench
Copy link

@correct-horse-battery-bench correct-horse-battery-bench commented Mar 9, 2026

During manual testing and writing tests I noticed a few dead code paths and typing improvements which allowed to remove / simplify some redundant code. Regarding typing, some things here I think are essential and some changes are opiniated. Happy to discuss with whoever reviews this pr.

Main Changes:

  • Use form.controls.<name> instead of form.get in order to have stricter typing
  • Remove whichView and copyType, isCopyHashlist dead variables not used anymore in any code path, whichView previously was 'create' or 'edit' but there seems to exist now an edit-task page dedicated for that. Type the kind passed by the router as data
  • use takeUntilDestroyed instead of UnsubscriptionService
  • use firstValueFrom and await if possible
  • Generally add some more restricted typing

@correct-horse-battery-bench correct-horse-battery-bench force-pushed the add-tests-and-improve-new-tasks-typing branch from ef4c6c9 to 5961e77 Compare March 9, 2026 13:41

@if (!isLoading) {
<div fxLayout="column" fxLayoutAlign="start start">
@if ((copyMode && isCopyHashlistId) || (!copyMode && !isCopyHashlistId)) {

Choose a reason for hiding this comment

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

Riskiest change of the pr and worth to have a look at.
When copying a pretask the value '9999' was used as placeholder there so that the input-multiselect is still shown when copying a pretask which is semantically incorrect as pre tasks do not seem to have an assigned hashlist.

Generally:
If new task -> always show this (!copyMode)
If we copy a pretask/task we still want to show this input as all tasks seem to need one

The !isCopyHashlistId seems to just check if we load a task that the hashlistId of it seems to be loaded (as default null). But the form is patched anyways so it seems to me that this check is not needed anymore...

@correct-horse-battery-bench correct-horse-battery-bench marked this pull request as ready for review March 9, 2026 15:20
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.

1 participant