> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/free-resources/mango-notify/developer-guide/updating-and-queues.md).

# Updating and Queues

Ids and live updates, persistent notifications, the queue, priorities, dedupe, and replace mode.

## Ids

Every notification has an id. Pass your own (`id = 'bank_alarm'`) or let Mango Notify generate one — `Notify()` returns it either way. Ids are the handle for everything on this page.

```lua
local id = exports.mango_notify:Notify({ title = 'Connecting...' })
```

## Live updates

`Update(id, patch)` merges the patch into the notification and re-renders it in place — whether it is currently visible **or still waiting in the queue**. Timers behave sensibly: pass a new `duration` to restart the clock, or omit it and the original countdown (and its progress bar) carries on unchanged.

```lua
local id = exports.mango_notify:Notify({
    title = 'Crafting', description = 'Assembling parts... 0%', duration = 0,
})

for i = 1, 10 do
    Wait(500)
    exports.mango_notify:Update(id, { description = ('Assembling parts... %d%%'):format(i * 10) })
end

exports.mango_notify:Update(id, {
    type = 'success', title = 'Done', description = 'Weapon crafted.', duration = 3000,
})
```

Calling `Notify` again with an id that is already on screen also updates in place — it never stacks a duplicate of the same id.

## Persistent notifications

`duration = 0` (or `false`) keeps a notification on screen until you `Remove(id)` or `Clear()` — ideal for ongoing states like "in queue", "downloading", or a standing warning. A persistent notification shows the static accent line instead of a progress bar.

## The queue

`Config.MaxNotifications` caps how many notifications are visible at once (in total, across all positions). When the cap is hit, behaviour depends on the mode:

* **`'queue'`** (default) — new notifications wait in a FIFO queue and appear as slots free up.
* **`'replace'`** — the oldest visible notification is pushed out immediately to make room.

The mode is set globally with `Config.QueueMode` and can be overridden per call with `queueMode = 'replace'`.

### Priorities

Queued notifications with a higher `priority` (default `0`) jump ahead of lower-priority ones — they still respect FIFO order among equals.

```lua
exports.mango_notify:Notify({ title = 'EMS dispatched', priority = 10 })
```

### Duplicate prevention

With `Config.DuplicatePrevention = true` (or `dedupe = true` per call), a notification identical to one already visible — same type, title, and description — refreshes the existing notification's timer instead of stacking a copy. Useful for spammy sources like zone warnings.

## Inspecting state

```lua
exports.mango_notify:IsVisible('bank_alarm')   -- true while visible or queued
exports.mango_notify:GetQueue()                -- { { id = ..., data = ... }, ... }
```

{% hint style="info" %}
Both are instant local reads — the resource mirrors the UI state on the Lua side, so neither call waits on the NUI.
{% endhint %}
