Tab Data Types and History

Behind every tab is a data type definition that tells the system what to render and how to route. Tab data types are the bridge between the generic tab system and the specific domain components that display zone details, customer records, industry configurations, and other views.

Tab Data Types

A tab data type is a configuration record that defines how a category of tabs behaves. Each data type specifies a component name (which React component renders the tab content), a URL pattern (how the tab's content maps to browser URLs), default properties (initial configuration for new tabs of this type), an icon and color for visual identification in the tab bar, and whether auto-refresh is enabled and at what interval.

Common Data Types

The Dashboard data type renders the main dashboard overview. It has no data reference ID because it is not tied to a specific record. It is the only tab type that is always pinned.

Zone Detail renders the zone detail view with top tabs for Overview, Coverage, Labor, Industries, Pricing, and Scheduling. Its data reference ID points to a specific zone record. Opening a zone in the dashboard creates a tab with this data type.

Industry Detail renders the industry configuration view with tabs for Overview, Categories, Products, Materials, and more. Each industry variant (Cleaning, Junk Removal, Carpet Cleaning) uses the same data type but with different tab configurations determined by the industry's type.

Customer Detail renders the customer profile with booking history, payment methods, and account information.

How Data Types Route

When a tab is activated, the system looks up its tab data's data type to determine which component to render. The component name maps to a dynamic import that loads the appropriate React component. The data reference ID is passed as a prop, allowing the component to fetch and display the correct record.

Tab Data Records

The tab data record is the intermediary between a tab and its content. It stores the data type reference (which kind of tab this is), the data reference ID (which specific record to display), the data source (typically "internal" for database records), component-specific properties, auto-refresh configuration, and persisted state including scroll position, filters, and pagination.

Tab data records are separate from tab records because the same data reference might be opened in different contexts. For example, a zone might be opened as a standalone tab and also embedded in a reporting view. The tab data record captures the view-specific state, while the tab record captures the workspace-specific position and display name.

Tab State Persistence

Each tab data record maintains a state object that captures the component's current UI state. This state is saved on every tab switch and at regular intervals during active use.

What Gets Persisted

Scroll state captures vertical and horizontal scroll offsets for the main content area. When you return to a tab, the page scrolls to exactly where you left off.

Filters capture active search terms, selected status filters, date ranges, and other filter controls. Your filter configuration is preserved across tab switches and page reloads.

Pagination captures the current page number and items-per-page setting. If you were on page 3 of a 10-page result set, you return to page 3.

Active top tab captures which sub-tab is selected within the record detail view. If you were viewing the Coverage tab of a zone, switching away and back returns you to Coverage, not the default Overview.

Custom state is a flexible JSON object that components can use to persist any additional state specific to their needs.

Tab History

Tab history provides a chronological record of recently closed tabs, enabling restoration of accidentally closed work.

How History Works

When a tab is closed, the system records the tab's data type, data reference ID, display name, close timestamp, and last known state in the tab history. History entries are scoped to the workspace — each workspace maintains its own independent history.

Accessing History

The most common way to access history is the Ctrl+Shift+T keyboard shortcut, which reopens the most recently closed tab. For older entries, the tab history view shows all recently closed tabs with their names and timestamps. Clicking an entry restores the tab.

History Retention

History entries are retained for 30 days by default. After 30 days, entries are archived and no longer appear in the quick-access list. The archive can still be searched but entries are not automatically restored.

History Across Sessions

Tab history persists across page reloads and re-logins because it is stored in the database alongside the workspace. When you return to a workspace, the full history is available. However, history is workspace-scoped — switching workspaces gives you a different history.

Data Type Extensibility

New tab data types can be added as the system grows. When a new module is built (e.g., a Contracts module), a new tab data type is registered with the appropriate component name, URL pattern, and default configuration. Existing workspaces can then open tabs of the new type without any changes to the tab infrastructure.