Skip to content

Fix card creation context loss when opening cards - #16

Merged
ArtyomSavchenko merged 2 commits into
developfrom
claude/card-add-error-open-card-bdos9p
Jul 30, 2026
Merged

Fix card creation context loss when opening cards#16
ArtyomSavchenko merged 2 commits into
developfrom
claude/card-add-error-open-card-bdos9p

Conversation

@ArtyomSavchenko

Copy link
Copy Markdown
Member

Summary

Fixed an issue where the selected class and space context was lost when opening a card, preventing the create action from working properly after card navigation.

Key Changes

  • CardHeaderButton.svelte: Modified location tracking to persist the last selected class and space values instead of directly binding to the location path. Added updateContext() function that only updates these values when a valid class is present in the path, preserving the context when the path is truncated after opening a card.
  • utils.ts: Enhanced isBaseTypeWithSubtypes() to safely handle undefined type values by adding an early null/existence check before attempting to access the hierarchy.

Implementation Details

  • The location path loses the selected class (path[4]) when a card is opened because the path gets truncated to just the card ID at path[3]
  • By caching the last known class and space values, the create action can still reference them even after navigation
  • Added defensive null checking in isBaseTypeWithSubtypes() to prevent errors when called with undefined types

https://claude.ai/code/session_014LX69tCYrjW2nNb7sT3iPu

claude and others added 2 commits July 27, 2026 02:34
Opening a card sets path[3] to the card id and truncates the location
path, dropping the selected class (path[4]). CardHeaderButton derived
_class from path[4], so after opening a card it became undefined and
isBaseTypeWithSubtypes crashed with "class not found: undefined" when
the + button was clicked again.

Remember the last selected class/space in CardHeaderButton so the create
action keeps its context after a card is opened, and guard
isBaseTypeWithSubtypes against an undefined/unknown type.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014LX69tCYrjW2nNb7sT3iPu
Signed-off-by: Artem Savchenko <armisav@gmail.com>
@ArtyomSavchenko
ArtyomSavchenko marked this pull request as ready for review July 30, 2026 06:13
@ArtyomSavchenko
ArtyomSavchenko merged commit a013405 into develop Jul 30, 2026
18 checks passed
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.

3 participants