Skip to content

TypeError in useResizable composable when storageData is null #4963

@XStarlink

Description

@XStarlink

🐛 Describe the bug

The useResizable composable crashes with TypeError: null is not an object (evaluating 'd.value.collapsed') when storageData.value is null.

🔗 Reproduction

This happens when:

  • First time visiting (empty localStorage)
  • Corrupted localStorage
  • Private browsing mode with storage disabled
  • iOS Safari with storage restrictions

📱 Environment

  • Device: iPhone
  • OS: iOS 18.6
  • Browser: Mobile Safari 26.0
  • Nuxt UI Pro: Latest version
  • Page: /chats/:id() (any page using resizable components)

📊 Error Details

Stack trace:

./node_modules/@nuxt/ui-pro/dist/runtime/composables/useResizable.js:27:28 (isCollapsed.get)
    get: () => storageData.value.collapsed,

Error message:

TypeError: null is not an object (evaluating 'd.value.collapsed')

💡 Expected behavior

The composable should handle null storage gracefully with a fallback value.

🔧 Suggested Fix

// Current problematic code (line 27):
get: () => storageData.value.collapsed,

// Suggested fix:
get: () => storageData.value?.collapsed ?? false,

📈 Impact

  • Frequency: Low (2 occurrences detected)
  • Severity: High (crashes the page on affected devices)
  • Users: Mobile Safari users, especially on first visit

🔍 Additional Context

This is particularly problematic on iOS Safari which has stricter localStorage policies and can return null in various scenarios.

The same pattern should be checked in other parts of useResizable to ensure consistent null-safety.

Is this bug related to Nuxt or Vue?

Nuxt

Package

v3.x

Version

v3.3.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingp2-mediumNotable issue or useful enhancementv3#1289

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions