# Reprocessing in the Consent JavaScript SDK

The **Consent JavaScript SDK** includes a powerful feature called **reprocessing**.\
This allows JENTIS to **re-evaluate and re-trigger tracking commands** whenever consent information is updated—without requiring a full page reload.

Reprocessing ensures that any previously triggered commands are executed (or withheld) according to the **latest consent state** for a given vendor.

### How Reprocessing Works

* Reprocessing occurs **only when the page scope remains the same**.
* If the page is reloaded, the JavaScript scope is reset, and all tracking starts fresh.
* All **JENTIS States**—such as `track:event`, `track:submit`, or any other custom state, are stored temporarily.
* When consent for a tool (vendor) changes, these stored commands are reprocessed to match the new consent decision.

**Example:**\
If a user initially denies consent for Analytics, but later accepts it, previously triggered events (e.g., a `track:pageview`) can be reprocessed so they are now sent to Analytics.

### Special Case: Single Page Applications (SPAs)

For SPAs (e.g., React, Vue, Angular), navigation within the app also **resets reprocessing**.\
This means:

* Even if an event is still available in memory, JENTIS clears its internal cache on navigation.
* JENTIS treats SPA navigations and regular page reloads the same—**no reprocessing occurs** unless explicitly configured otherwise.

### Controlling Reprocessing Reset

You can control whether **navigation resets the reprocessing cache**:

```javascript
javascriptCopyEdit// Disable reprocessing reset (keep events across SPA navigations)
window.jentisApp.reprocessingCache_deactivate_reset();

// Enable reprocessing reset (default behavior)
window.jentisApp.reprocessingCache_activate_reset();
```

### Default Behavior

* By default, **reprocessing reset is active** → SPA navigations clear the cache.
* To keep reprocessing active across navigations, call `reprocessingCache_deactivate_reset()` **before JENTIS initializes**.

### When to Call the Reset Functions

**Timing is critical**:

* In **JENTIS**: Use the trigger **Before JENTIS Bundle Load**.
* In your **own application**: Call the function together with the JTM container code snippet.

✅ **Tip:** Use reprocessing strategically to ensure users’ updated consent choices apply instantly without losing valuable tracking data.
