# Data Realtime V2 (beta)

### Overview

This function is currently in Beta however should be fine for you to test it out with smaller lists and tables.&#x20;

With `2.15.0` the plugin now offers a new and more efficient data handling using Supabase Realtime only. There's two new settings to check:&#x20;

* **Data Realtime V2 (Beta):** a simple boolean to enable the new system. If you leave it as false, the plugin just works as before and the Primary Key is not necessary.&#x20;
* **Primary Key:** This is needed for the new system to properly work, when handling Update and Delete events. If you've enabled the new system but left this empty, the plugin will uses the old system instead, since leaving this empty would break it.

<figure><img src="https://565817280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmxSvZ04SZeWMqvozlHui%2Fuploads%2FZBgXTSJX49eyCWi8rkvp%2Fimage.png?alt=media&#x26;token=9c61a678-dd64-41cc-9c34-1a599b0bdb1f" alt=""><figcaption></figcaption></figure>

### Under the Hood

The new system essentially uses the payload of the Realtime messages to manipulate the initial query and re-parse the updated data. With Every Insert, Update and Delete we get the Old and New data sent to us via the Websockets. The Bubble event "Database change happened" will fire everytime still. So what happens at each action:

* UPDATE: We find the relevant entry based on the Primary Key, update it based on the New data, and parse it back to Bubble objects.
* DELETE: We find the relevant entry based on the Primary Key, delete the entry and parse the response back to Bubble objects.
* INSERT: The Plugin will attempt to insert the entry based on your initial sorting and query at the right position, if it cannot it will add it to the bottom of the list.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.relevat.hu/supabase.js-bubble-plugin/setup/supabase-data/data-realtime-v2-beta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
