> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle Unsaved Changes and Session Timeout

> This guide explains how Nextedy GANTT protects your work from accidental data loss and how to recover from session timeouts during editing.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

## How Unsaved Change Protection Works

The Gantt tracks every modification you make during an edit session -- dragging task bars, resizing durations, editing fields in the lightbox, and creating new tasks. When the Gantt detects unsaved changes and you attempt to navigate away, it intervenes to prevent data loss.

<Frame>
  <img src="https://mintcdn.com/none-17b4493f/DDjWgCW2DWY5biNv/gantt/diagrams/guides/editing/unsaved-changes/diagram-1.svg?fit=max&auto=format&n=DDjWgCW2DWY5biNv&q=85&s=434461463d56e5de1ba27a9db8d16ec0" alt="diagram" style={{ maxWidth: "680px", width: "100%" }} width="680" height="620" data-path="gantt/diagrams/guides/editing/unsaved-changes/diagram-1.svg" />
</Frame>

## Navigation Protection

The Gantt intercepts three types of navigation when you have unsaved changes:

| Navigation Type               | Protection                      | Dialog                                  |
| ----------------------------- | ------------------------------- | --------------------------------------- |
| Close browser tab / window    | Browser beforeunload event      | Browser's built-in "Leave site?" prompt |
| Click a link on the page      | Link click interception         | "Discard changes?" confirmation dialog  |
| Browser back / forward button | History navigation interception | "Discard changes?" confirmation dialog  |

When any of these events occur:

1. The Gantt checks whether there are unsaved changes (dirty state)
2. If changes exist, a confirmation dialog appears
3. Choose **Cancel** to stay on the page and continue editing
4. Choose **Discard** (or leave the page) to abandon unsaved changes

<Warning title="Save frequently during long editing sessions">
  The Gantt undo history stores up to `10` changes by default. For complex rescheduling involving many tasks, save periodically to avoid losing work if the browser crashes or the session expires.
</Warning>

## Save Your Changes

To persist your edits to Polarion:

1. Click the **Save** button in the Gantt toolbar (or the floating save button if the toolbar is hidden)
2. A progress indicator appears during the save operation
3. After a successful save, the dirty state clears and navigation protection is removed
4. If no changes exist, the save button does nothing

## Recover from Session Timeout

When your Polarion session expires while you are editing the Gantt -- for example, due to SSO logout or inactivity timeout -- the save operation may fail.

<Tip title="SSO logout recovery (v24.9.2+)">
  Starting with version 24.9.2, the Gantt displays a clear notification when your session has expired during editing. To recover your unsaved work:

  1. Open a new browser tab
  2. Log in to Polarion in the new tab
  3. Return to the Gantt tab
  4. Click **Save** again -- your changes are preserved in the browser and will save successfully with the new session
</Tip>

<Warning title="Older versions may lose data on session timeout">
  In versions before 24.9.2, a session timeout during editing could result in a save failure without clear feedback. Update to the latest version for improved session management. See [Update to the Latest Version](/gantt/getting-started/update-gantt).
</Warning>

## Dirty State Tracking

The Gantt maintains a dirty state flag that indicates whether any unsaved changes exist. This flag drives several behaviors:

* The **Save** button becomes active when changes are pending
* Navigation protection activates when dirty state is `true`
* The dirty state clears after a successful save or when you explicitly discard changes
* Each individual task also tracks its own dirty state, enabling the Gantt to identify which specific work items need updating

## Interaction with Editing Modes

| Configuration                | Unsaved Change Protection                         |
| ---------------------------- | ------------------------------------------------- |
| Default (Edit/Close buttons) | Active during edit mode; clears on Close Editing  |
| `alwaysedit = true`          | Always active when changes exist                  |
| `readonly = true`            | Not applicable -- no editing possible             |
| `hideToolbar = true`         | Active; a floating save button appears for saving |

## Verify Your Configuration

1. Enter Edit mode and drag a task bar to a new date
2. Try to navigate to another page by clicking a link
3. You should now see a "Discard changes?" confirmation dialog
4. Click **Cancel** to return to the Gantt, then click **Save** to persist your change

## See Also

* [Use Undo and Redo](/gantt/guides/editing/undo-redo) for reversing changes before saving
* [Troubleshooting Save Failures](/gantt/guides/troubleshooting/save-failures) for resolving save errors
* [Configure the Toolbar and Menus](/gantt/guides/layout/toolbar-configuration) for toolbar and save button visibility
* [Perform What-If Analysis Without Saving](/gantt/guides/scheduling/what-if-analysis) for exploring changes without committing

<LastReviewed date="2026-07-02" />
