# Bug OP-20334 - Switching a work-package table to cards after resizing throws a timeline error

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-20334

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Work packages, Frontend components and Primer design system |
| Target versions | 18.0.0 |
| Observed in versions | 18.0.0, 17.9.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Alexander Coles |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Before filing a report

Reproduced twice locally on 2026-09-26 while reviewing <mention class="mention" data-id="DREAM-865" data-type="work_package" data-text="#DREAM-865">#DREAM-865</mention> / PR <mention class="mention" data-id="25619" data-type="work_package" data-text="#25619">#25619</mention>. Searched for “table destroyed” and “timeline null”; no matching report identified. Reproduced on both QA edge and stage on 2026-09-26.

### Steps to reproduce

Preconditions: sign in as a user permitted to view a populated work-package table and change its view sorting. No work-package edit permission or second user is needed. Keep the browser console open.

1.  At a desktop viewport width (1280 px used), open [edge: Demo project work packages](https://qa.openproject-edge.com/projects/DP/work_packages) or [stage: work packages](https://qa.openproject-stage.com/work_packages), and wait for the table.
2.  Resize the viewport to 500 px wide, below the application's 544 px mobile breakpoint. Browser DevTools responsive mode can set the width precisely; keep desktop emulation. Do not reload.
3.  Open the ID column menu on the existing table.
4.  Change its sort order: choose **Sort descending** if it is currently ascending, or vice versa. Choosing the existing order may not trigger a refresh.
5.  Wait for the refreshed query to switch the table to cards and inspect the console.

### What is the buggy behavior?

An uncaught `TypeError: Cannot read properties of null (reading 'querySelectorAll')` is thrown by `TimelineTransformer.renderVisibility` after the table has been destroyed and replaced by a card view.

The old timeline subscription still receives query initialization updates and accesses the removed table container's parent. The exception reproduced on both QA instances and twice locally, including a local run without diagnostic instrumentation.

The confirmed symptom is the uncaught exception during an ordinary responsive-view interaction; this report does not claim that all card actions become unusable.

### What is the expected behavior?

Switching from table to cards cleans up the removed table's subscriptions. Later query/view updates must not invoke callbacks against detached table DOM and must complete without an uncaught exception.

### Important note

Reproduced on QA edge (`dev`, reported version 18.0.0) and QA stage (`release/*`, reported version 17.9.0) on 2026-09-26. These are browser reproductions on shared QA deployments, independent of the unmerged test stack. No work-package data was changed.

### **Logs**

``` text
Uncaught TypeError: Cannot read properties of null (reading 'querySelectorAll')
  at renderVisibility (timeline-transformer.ts:59:15)
  at timeline-transformer.ts:50:14
  at initialize (wp-view-base.service.ts:67:24)
  at initializeFromQuery (wp-states-initialization.service.ts:186:26)
  at initialize (wp-states-initialization.service.ts:95:10)
  at partitioned-query-space-page.component.ts:256:37 (edge)
  at partitioned-query-space-page.component.ts:258:37 (stage)
  ... query refresh -> sort update -> column-menu click
```

Source investigation: `TimelineTransformer` stops on `querySpace.stopAllSubscriptions`, but `WorkPackagesTableComponent.ngOnDestroy` does not emit that signal. A separate test-harness experiment reported NG0205 after shared-cache updates; that specific error was not reproduced in the browser and is not the reproduction claimed here.

### Screenshots and other files

No screenshot attached. The QA links and steps above allow manual reproduction. Browser evidence is also recorded in the DREAM-863–865 review notes.

### Environment information

**OpenProject installation type**

Other: OpenProject QA edge and QA stage deployments; underlying deployment packaging not checked. Also reproduced on a local Rails/frontend development server.

**OpenProject version**

Local branch `implementation/dream-865-backfill-table-lifecycle-configuration-coverage`, commit `6928f2108014e94ddadd8417c1d7d59fa2b399d6`, tested 2026-09-26. This local result is supplementary to the QA reproductions.

Confirmed on [QA edge](https://qa.openproject-edge.com/) (`dev`, API reports **18.0.0**) and [QA stage](https://qa.openproject-stage.com/) (`release/*`, API reports **17.9.0**), tested 2026-09-26. Exact deployed commit SHAs were not established.

**Browser**

- [x] Chrome — reported version 153.0.0.0
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [ ] Other

**Operating System**

- [ ] Windows
- [x] Mac OS X
- [ ] Mobile iOS
- [ ] Mobile Android
- [ ] Linux
- [ ] Chrome OS
- [ ] Other

**Language**

Browser: en-GB. OpenProject interface: English (`html lang=en`).
