fix(calendar): default new task to the last-activated board#991
Merged
Conversation
The create-task modal pre-selected the lowest-id board (the first-created board, e.g. "Miljøtilsyn") whenever more than one board was active in the sidebar, ignoring the board the user had just marked active. The sidebar "active" state is a transient multi-select visibility filter with no persisted default-board concept, and the modal only honoured it when exactly one board was checked. Track the most-recently-activated board in memory: set it when the user turns a board ON in the sidebar (and seed it to the auto-selected board on load), and default the create-task modal to it while it stays active. Falls back to the existing behaviour when that board is no longer active. No DB/API change. Adds a Playwright e2e (n/calendar-default-board.spec.ts) covering the default and the fallback, and an id on the board select for the test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes the calendar create-task flow so the board (“tavle”) dropdown defaults to the most recently activated board (instead of falling back to the lowest-id board when multiple boards are active). This is implemented entirely in the Angular frontend with an accompanying Playwright regression test.
Changes:
- Track
lastActivatedBoardIdinCalendarContainerComponentand prefer it when opening the create-task modal (when it’s still active). - Add a stable DOM hook (
id="calendarEventBoard") to the board select in the task create/edit modal. - Add a new Playwright serial e2e suite covering “last-activated board” defaulting and the fallback when that board is later deactivated.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| eform-client/src/app/plugins/modules/backend-configuration-pn/modules/calendar/modals/task-create-edit-modal/task-create-edit-modal.component.html | Adds a stable selector id for the board dropdown to support e2e assertions. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/modules/calendar/components/calendar-container/calendar-container.component.ts | Introduces lastActivatedBoardId and uses it to choose the modal’s default board selection. |
| eform-client/playwright/e2e/plugins/backend-configuration-pn/n/calendar-default-board.spec.ts | Adds regression coverage ensuring the modal defaults to the last-activated board and falls back correctly when it’s deactivated. |
Comment on lines
+477
to
+479
| // The store update is async, so activeBoardIds here still reflects the | ||
| // pre-toggle state: if the board is not currently active, this click is | ||
| // turning it ON — remember it as the default for new tasks. |
Comment on lines
+25
to
+26
| async function createBoard(page: import('@playwright/test').Page, name: string) { | ||
| await page.locator('a.sidebar-action-link', { hasText: 'Opret tavle' }).click(); |
| expect(label.length).toBeGreaterThan(0); | ||
| expect(label).not.toBe(boardB); | ||
| }); | ||
| }); |
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.
What
Fixes a user-reported bug: when creating a calendar task, the board ("tavle") dropdown defaulted to the first-created board ("Miljøtilsyn") instead of the board the user had just marked active.
Root cause
There is no persistent "active/default board" concept — the sidebar checkbox toggles a transient in-memory visibility filter (
activeBoardIds). The modal only honoured it when exactly one board was checked; with more than one active (the common case: the auto-selected default board stays checked when the user activates a new one), it fell back to the lowest-id board.Fix
Track the most-recently-activated board in memory:
onBoardToggledrecords the board when the user turns it on.loadBoardsseeds it to the auto-selected board on load / property switch.openCreateModalpasses it to the modal while it's still active; otherwise the existing fallback is preserved.No DB/API/migration. The modal's own
find(...) ?? fallbackBoardalready guards a stale/deleted id.Tests
New Playwright e2e
n/calendar-default-board.spec.ts(3 serial tests): modal defaults to the last-activated board even when several stay checked; falls back (not the deactivated board) otherwise. All pass locally. Addedid="calendarEventBoard"to the board select as the test hook.Design spec:
docs/superpowers/specs/2026-06-09-calendar-new-task-default-board-design.md.🤖 Generated with Claude Code