> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.poool.fr/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Reloading the wall when cookie consent changes

In a Poool Access integration, the behavior of the wall can depend on the user’s cookie consent.
This information is passed through the configuration using the `cookies_enabled` variable. It allows the system to apply the correct scenario defined in the Dashboard and adapt the experience shown to the reader.

## Why reload the wall?

When a user lands on the page without having accepted cookies, Access is initialized with `cookies_enabled = false`.
In this case, a default behavior is applied depending on your setup.
If the user later accepts cookies (via your CMP), the Access configuration should update to `cookies_enabled = true`. However, the already displayed wall does not automatically update without a specific action.
As a result:
* the wall continues to operate with the previous state
* scenarios configured for `cookies_enabled = true` are not applied
Therefore, the wall must be reloaded to take this change into account.

## Implementation

Two approaches are possible depending on your integration level and user experience constraints.

### - Page reload

The simplest method is to reload the page after cookie acceptance, updating `cookies_enabled` to `true`.
This ensures that the entire Access initialization is re-executed with the correct configuration.
However, it comes with a full page reload, which may affect the user experience.

### - Wall reset

For a smoother integration, it is possible to reload only the wall.
The idea is to:
* update the configuration (`cookies_enabled = true`)
* recreate a paywall instance
A second initialization is then performed with the updated context.
The wall is directly replaced on the page without a full reload.
This approach preserves a continuous user experience while correctly applying the scenarios defined in the Dashboard.

## Important note: Audit.js

If you are using the Audit script, an important consideration applies.
Audit.js does not dynamically reload once initialized.
If it is loaded with `cookies_enabled = false`, it will not be reinitialized after cookie consent is granted.
This can lead to tracking data loss.
In this case, it is recommended to:
* load Audit only after consent is granted
or
* condition its loading based on the cookie state

## JS example

A sandbox example is available to demonstrate:
* the cookie consent change
* wall reinitialization
* Access and Audit script behavior
[This is the link.](https://codesandbox.io/p/sandbox/currying-fire-lwfr4x)

## React / Next.js implementation

In a React application, when the value of `cookies_enabled` changes, it is necessary to force a component re-render to properly reinitialize the wall with the updated configuration.
This is because React does not automatically recreate a component when only internal props change.
As a result, the already mounted wall continues to use the previous state (`cookies_enabled = false`).
You must trigger a remount of the component.

Two common approaches:
* Use a dynamic `key` on the component
* Manage a state variable that forces reinitialization