no-browser-storage rule prevents usage of browser storage APIs (localStorage and sessionStorage).
Rule details
UI extensions run in a sandboxed web worker environment where browser storage APIs (localStorage and sessionStorage) are intentionally unavailable for security and isolation. This prevents extensions from accessing storage data from the host application, storing sensitive data without proper security controls, or interfering with other extensions.
Storage APIs don’t exist at runtime and will throw errors if accessed. Instead, use React state for temporary data or backend APIs for persistent data.
Storage alternatives
Use the following UI extension alternatives instead of browser storage APIs:| Use Case | Alternative | Purpose |
|---|---|---|
| Temporary session data | React state (useState, useReducer) | Store component state |
| Persistent user data | hubspot.fetch() + backend API | Store data across sessions |
| Complex app state | React Context + useReducer | Manage shared state |
| API response caching | React state with custom hooks | Cache data in memory |
Examples
Temporary data
Instead of usingsessionStorage for temporary form data:
Persistent data
Instead of usinglocalStorage for persistent user preferences:
hubspot.fetch() to persist data via your backend:
Complex state management
Instead of usinglocalStorage for app-wide state:
useReducer: