Skip to content

Conversation

@silverkszlo
Copy link
Contributor

Summary

Problem

Embedding a Deck board (Vue + Vue Router) inside the Whiteboard app (React) caused a runtime error. The Deck component attempted to access this.$route.params.cardId during initialization — but when running inside Whiteboard, there’s no Vue Router context, so this.$route was undefined, triggering:
TypeError: can't access property "params", this.$route is undefined

Root Cause

In Board.vue, the fetchData() method runs in the created() hook and directly references this.$route.params.cardId. This works in the full Deck app but fails when embedded.

Solution

Added optional chaining to safely access route data:
const routeCardId = this.$route?.params?.cardId ? parseInt(this.$route.params.cardId) : null

  • In Deck (with router): normal behavior, card ID loads from URL
  • In Whiteboard (no router): returns null, preventing the error

TODO

  • ...

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Documentation (manuals or wiki) has been updated or is not required

@grnd-alt
Copy link
Member

/backport to stable29

@grnd-alt
Copy link
Member

/backport to stable30

@grnd-alt
Copy link
Member

/backport to stable31

@grnd-alt
Copy link
Member

/backport to stable32

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