Skip to content

fix: prevent DataAmount crash by guarding dataSize access#16

Open
rahul810050 wants to merge 1 commit intooaiedu:masterfrom
rahul810050:fix/data-amount-null-guards
Open

fix: prevent DataAmount crash by guarding dataSize access#16
rahul810050 wants to merge 1 commit intooaiedu:masterfrom
rahul810050:fix/data-amount-null-guards

Conversation

@rahul810050
Copy link

@rahul810050 rahul810050 commented Jan 29, 2026

Fixed issue: #15

Summary

This PR fixes a dashboard crash caused by unsafe access to nested dataSize
properties in DataAmount.vue before Firestore data is fully loaded.

Root Cause

dataSize is set asynchronously. During initial render, nested fields such
as questions.general may be undefined, leading to runtime errors.

Changes

  • Refactored DataAmount.vue to derive all values via computed properties
  • Added safe default values for users, questions, tests, and subjects
  • Removed unsupported optional chaining from Vue 2 templates

Result

  • Dashboard no longer crashes on initial load
  • Component renders safely under slow network conditions
  • Fully compatible with Vue 2 template compiler

Before:
image

After:
image

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.

1 participant