@@ -253,37 +253,64 @@ const displayedMembers = computed(() => {
253253});
254254
255255const trelloTick = async () => {
256- if (! cardId ) {
257- cardId = (await getTrelloCard ().card (' id' )).id ;
258- }
256+ try {
257+ // Check if we have valid board context before proceeding
258+ const context = getTrelloCard ().getContext ();
259+ if (! context .board ) {
260+ console .debug (
261+ ' [activity-timer] Board context missing, skipping trelloTick'
262+ );
263+ return ;
264+ }
259265
260- canWrite . value = await getTrelloCard (). memberCanWriteToModel ( ' card ' );
261- visible . value = await isVisible () ;
262- hasEstimates . value = await hasEstimateFeature ();
266+ if ( ! cardId ) {
267+ cardId = ( await getTrelloCard (). card ( ' id ' )). id ;
268+ }
263269
264- const memberId = await getMemberId ();
265- const card = getCardModel ();
270+ canWrite .value = await getTrelloCard ().memberCanWriteToModel (' card' );
271+ visible .value = await isVisible ();
272+ hasEstimates .value = await hasEstimateFeature ();
266273
267- isTracking . value = await card . isRunning ();
268- trackedTime . value = await card . getTimeSpent ();
274+ const memberId = await getMemberId ();
275+ const card = getCardModel ();
269276
270- const estimates = await card .getEstimates ();
271- totalEstimate .value = estimates . totalEstimate ;
277+ isTracking . value = await card .isRunning ();
278+ trackedTime .value = await card . getTimeSpent () ;
272279
273- const ownEstimateItem = estimates .getByMemberId (memberId );
280+ const estimates = await card .getEstimates ();
281+ totalEstimate .value = estimates .totalEstimate ;
274282
275- if (ownEstimateItem ) {
276- ownEstimate .value = ownEstimateItem .time ;
277- } else {
278- ownEstimate .value = 0 ;
279- }
283+ const ownEstimateItem = estimates .getByMemberId (memberId );
280284
281- // Load member summary
282- await loadMemberSummary ();
285+ if (ownEstimateItem ) {
286+ ownEstimate .value = ownEstimateItem .time ;
287+ } else {
288+ ownEstimate .value = 0 ;
289+ }
283290
284- // Resize iframe after data changes
285- await nextTick ();
286- setTimeout (resizeTrelloFrame , 100 );
291+ // Load member summary
292+ await loadMemberSummary ();
293+
294+ // Resize iframe after data changes
295+ await nextTick ();
296+ setTimeout (resizeTrelloFrame , 100 );
297+ } catch (e ) {
298+ // Silently handle context errors when board is no longer available
299+ // This commonly occurs when the card is closed or user navigates away
300+ const errorStr = String (e );
301+ if (
302+ errorStr .includes (' Invalid context' ) ||
303+ errorStr .includes (' missing board' )
304+ ) {
305+ console .debug (
306+ ' [activity-timer] Board context lost during trelloTick, ignoring'
307+ );
308+ return ;
309+ }
310+
311+ // Re-throw unexpected errors
312+ throw e ;
313+ }
287314};
288315
289316const loadMemberSummary = async () => {
0 commit comments