Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [Unreleased]

### Fixed

* Advanced filters stay within what Strapi accepts: at most 100 values for "is one of" / "is none of" and at most 100 conditions with "Any condition" (the `arrayLimit` of Strapi's `strapi::query` middleware; Strapi 5.63 answers a longer list with 400), and at most 20 conditions with "All conditions" (with more, the Content Manager list view does not render on Strapi 5.62 and 5.63). The editor says so next to the fields, in all five admin languages, instead of applying a filter that fails.
* Opening a bookmark whose filters exceed these limits shows a notice that explains how to fix it, instead of a list view that fails. Magic Mark 4.x already refuses to save more than 100 items in one list; older bookmarks can still hold more.
* The Advanced filters dialog no longer logs the Radix "Missing `Description`" warning: its title is its only label (`aria-describedby={undefined}`).

## [4.0.2](https://github.com/Schero94/Magicmark/compare/v4.0.1...v4.0.2) (2026-11-17)


Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ appear as filter tags and can be removed one by one. With **Any condition** the
correctly, but Strapi does not show those conditions as tags; open Advanced filters to change or
clear them.

A filter can have at most 100 values for "is one of" / "is none of" and at most 100 conditions
with **Any condition**: that is the `arrayLimit` of Strapi's `strapi::query` middleware, and from
Strapi 5.63 a longer list is answered with 400. With **All conditions** the limit is 20, because
the Content Manager list view does not open with more `$and` conditions in the URL (Strapi 5.62
and 5.63). Advanced filters shows these limits next to the fields, and a bookmark with a longer
list is not opened: a notice asks you to narrow the filters and save the current view into the
bookmark again.

## Configuration

Magic Mark has no configuration options and reads no environment variables. Access is controlled
Expand Down Expand Up @@ -364,6 +372,7 @@ you deploy the upgrade.
| Users are listed without email | Email is shown only to admins who can read admin users. |
| Advanced filters show only some fields | The role can read only those fields of the content type in the Content Manager. |
| "This bookmark does not point to a list view" | A 3.x bookmark had an unusual path. Delete it and save the view again. |
| "This bookmark was not opened: a filter in it has more than 100 values or conditions" | Strapi accepts at most 100 items in one filter list. Open the list, narrow that filter, then save the current view into the bookmark. |
| After an upgrade with several instances, some processes stopped with "already exists" | Strapi's schema sync ran in several processes at once. Restart them; see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster). |
| The plugin does not show up after installing | Rebuild the admin panel (`npm run build`) and restart Strapi. |

Expand Down
60 changes: 56 additions & 4 deletions admin/src/components/AdvancedFiltersModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
SingleSelectOption,
TextButton,
TextInput,
Typography,
} from '@strapi/design-system';
import { Plus, Trash } from '@strapi/icons';
import { deepEncodeQueryValues, useQueryParams, withEncodedUserParams } from '@strapi/strapi/admin';
Expand All @@ -32,14 +33,17 @@ import { useIntl } from 'react-intl';
import { useFilterFields } from '../hooks/useSchemas';
import {
LIST_OPERATORS,
MAX_LIST_ITEMS,
NO_VALUE_OPERATORS,
maxConditions,
RANGE_OPERATORS,
type FieldOption,
type FilterRow,
type MatchMode,
buildFilters,
datetimeToInput,
fitsAdminQueryDepth,
hasTooManyValues,
inputToDatetime,
isDateOnly,
nextRowId,
Expand Down Expand Up @@ -100,7 +104,12 @@ export const AdvancedFiltersModal = ({ open, onOpenChange, uid }: AdvancedFilter

const activeRows = rows.filter((row) => row.field || row.value);
const rowErrors = new Map(activeRows.map((row) => [row.id, validateRow(row, fieldMap)]));
const hasErrors = [...rowErrors.values()].some(Boolean);
// Strapi accepts at most 100 conditions in one $or list (400 above that); with "all" the
// Content Manager list renders at most 20 (see maxConditions).
const rowLimit = maxConditions(match);
const tooManyRows = activeRows.length > rowLimit;
const atRowLimit = rows.length >= rowLimit;
const hasErrors = tooManyRows || [...rowErrors.values()].some(Boolean);

const apply = () => {
setShowErrors(true);
Expand Down Expand Up @@ -133,6 +142,16 @@ export const AdvancedFiltersModal = ({ open, onOpenChange, uid }: AdvancedFilter
};

const errorText = (row: FilterRow, part: string) => {
// A list that is too long is shown while typing, so the limit is clear before applying.
if (part === 'value' && hasTooManyValues(row)) {
return formatMessage(
msg(
'filters.errorTooManyValues',
'Enter at most {max} values. Strapi does not accept longer lists.'
),
{ max: MAX_LIST_ITEMS }
);
}
if (!showErrors || rowErrors.get(row.id) !== part) return undefined;
if (part === 'field') return formatMessage(msg('filters.errorField', 'Choose a field.'));
if (part === 'operator')
Expand All @@ -142,7 +161,7 @@ export const AdvancedFiltersModal = ({ open, onOpenChange, uid }: AdvancedFilter

return (
<Modal.Root open={open} onOpenChange={onOpenChange}>
<Modal.Content onKeyDown={keepFocusInside}>
<Modal.Content onKeyDown={keepFocusInside} aria-describedby={undefined}>
<Modal.Header closeLabel={formatMessage(msg('form.close', 'Close'))}>
<Modal.Title>{formatMessage(msg('filters.title', 'Advanced filters'))}</Modal.Title>
</Modal.Header>
Expand Down Expand Up @@ -239,15 +258,48 @@ export const AdvancedFiltersModal = ({ open, onOpenChange, uid }: AdvancedFilter
</Box>
))}
</Flex>
<Box>
<Flex direction="column" alignItems="flex-start" gap={2}>
<TextButton
startIcon={<Plus />}
{...TEXT_BUTTON_TARGET}
disabled={atRowLimit}
aria-describedby={atRowLimit ? 'magic-mark-filters-row-limit' : undefined}
onClick={() => setRows((prev) => [...prev, emptyRow()])}
>
{formatMessage(msg('filters.add', 'Add condition'))}
</TextButton>
</Box>
{atRowLimit ? (
<Typography
id="magic-mark-filters-row-limit"
variant="pi"
textColor={tooManyRows ? 'danger600' : 'neutral600'}
role={tooManyRows ? 'alert' : undefined}
>
{formatMessage(
match === 'all'
? tooManyRows
? msg(
'filters.errorTooManyConditionsAll',
'With All conditions, keep at most {max} conditions: the Content Manager list does not open with more. Remove conditions or choose Any condition.'
)
: msg(
'filters.maxConditionsAll',
'With All conditions, a filter can have at most {max} conditions. The Content Manager list does not open with more.'
)
: tooManyRows
? msg(
'filters.errorTooManyConditions',
'Remove conditions until at most {max} are left. Strapi does not accept more.'
)
: msg(
'filters.maxConditions',
'A filter can have at most {max} conditions, the most Strapi accepts.'
),
{ max: rowLimit }
)}
</Typography>
) : null}
</Flex>
</Flex>
)}
</Modal.Body>
Expand Down
19 changes: 18 additions & 1 deletion admin/src/hooks/useOpenBookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
* stored value can never send the user to another admin page or off-site. Before navigating,
* boolean filter values are normalised for Strapi 5.62 (see `utils/booleanFilters`), and the
* Content Manager's remembered list settings for that content type are replaced by the
* bookmark's own, so remembered filters do not mix into the bookmark.
* bookmark's own, so remembered filters do not mix into the bookmark. A bookmark with a list
* longer than Strapi accepts (more than 100 `$in` values or `$or` conditions, which Strapi 5.63
* answers with 400, or more than 20 `$and` conditions, which the Content Manager list cannot
* render) is not opened: the user gets a notice that says how to fix it instead of an error.
*/
import { useFetchClient, useNotification } from '@strapi/strapi/admin';
import { useCallback } from 'react';
import { useIntl } from 'react-intl';
import { useNavigate } from 'react-router-dom';
import type { Bookmark } from '../types';
import { createAttributeResolver, sanitizeBooleanFilters } from '../utils/booleanFilters';
import { exceedsListLimit } from '../utils/filters';
import type { InitData } from '../utils/fieldOptions';
import { parseListViewPath, syncPersistedListSettings } from '../utils/listView';
import { parseQuery, stringifyQuery } from '../utils/query';
Expand Down Expand Up @@ -74,6 +78,19 @@ export const useOpenBookmark = () => {
return;
}
const parsed = parseQuery(bookmark.query);
if (exceedsListLimit(parsed)) {
toggleNotification({
type: 'warning',
timeout: 15000,
message: formatMessage(
msg(
'notification.listTooLong',
'This bookmark was not opened: its filters have more values or conditions than Strapi accepts. Open the list, narrow the filters, then save the current view in this bookmark.'
)
),
});
return;
}
let saved = parsed;
try {
saved = normalizeSavedQuery(parsed, await loadInit(get), location.uid);
Expand Down
6 changes: 6 additions & 0 deletions admin/src/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"filters.conditions": "Bedingungen",
"filters.errorField": "Feld auswählen.",
"filters.errorOperator": "Bedingung auswählen.",
"filters.errorTooManyConditions": "Bedingungen entfernen, bis höchstens {max} übrig sind. Mehr nimmt Strapi nicht an.",
"filters.errorTooManyConditionsAll": "Bei „Alle Bedingungen“ höchstens {max} Bedingungen verwenden: Mit mehr öffnet sich die Liste im Content Manager nicht. Bedingungen entfernen oder „Eine der Bedingungen“ wählen.",
"filters.errorTooManyValues": "Höchstens {max} Werte eingeben. Längere Listen nimmt Strapi nicht an.",
"filters.errorValue": "Wert eingeben.",
"filters.false": "falsch",
"filters.field": "Feld",
Expand All @@ -30,6 +33,8 @@
"filters.matchAll": "Alle Bedingungen",
"filters.matchAny": "Eine der Bedingungen",
"filters.matchAnyHint": "Diese Bedingungen erscheinen nicht als Filter-Tags über der Liste.",
"filters.maxConditions": "Ein Filter kann höchstens {max} Bedingungen haben, mehr nimmt Strapi nicht an.",
"filters.maxConditionsAll": "Bei „Alle Bedingungen“ kann ein Filter höchstens {max} Bedingungen haben. Mit mehr öffnet sich die Liste im Content Manager nicht.",
"filters.noFields": "Keine passenden Felder",
"filters.operator": "Bedingung",
"filters.remove": "Bedingung {number} entfernen",
Expand Down Expand Up @@ -106,6 +111,7 @@
"notification.invalidPath": "Dieses Lesezeichen verweist auf keine Listenansicht.",
"notification.linkCopied": "Link kopiert.",
"notification.linkCopyError": "Der Link konnte nicht kopiert werden.",
"notification.listTooLong": "Dieses Lesezeichen wurde nicht geöffnet: Seine Filter haben mehr Werte oder Bedingungen, als Strapi annimmt. Die Liste öffnen, die Filter eingrenzen und dann die aktuelle Ansicht in diesem Lesezeichen speichern.",
"notification.pinError": "Das Lesezeichen konnte nicht angeheftet werden.",
"notification.pinned": "Lesezeichen angeheftet.",
"notification.saveError": "Das Lesezeichen konnte nicht gespeichert werden. Die Änderungen sind noch im Formular.",
Expand Down
6 changes: 6 additions & 0 deletions admin/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"filters.conditions": "Conditions",
"filters.errorField": "Choose a field.",
"filters.errorOperator": "Choose a condition.",
"filters.errorTooManyConditions": "Remove conditions until at most {max} are left. Strapi does not accept more.",
"filters.errorTooManyConditionsAll": "With All conditions, keep at most {max} conditions: the Content Manager list does not open with more. Remove conditions or choose Any condition.",
"filters.errorTooManyValues": "Enter at most {max} values. Strapi does not accept longer lists.",
"filters.errorValue": "Enter a value.",
"filters.false": "false",
"filters.field": "Field",
Expand All @@ -30,6 +33,8 @@
"filters.matchAll": "All conditions",
"filters.matchAny": "Any condition",
"filters.matchAnyHint": "These conditions are not shown as filter tags above the list.",
"filters.maxConditions": "A filter can have at most {max} conditions, the most Strapi accepts.",
"filters.maxConditionsAll": "With All conditions, a filter can have at most {max} conditions. The Content Manager list does not open with more.",
"filters.noFields": "No matching fields",
"filters.operator": "Condition",
"filters.remove": "Remove condition {number}",
Expand Down Expand Up @@ -106,6 +111,7 @@
"notification.invalidPath": "This bookmark does not point to a list view.",
"notification.linkCopied": "Link copied.",
"notification.linkCopyError": "The link could not be copied.",
"notification.listTooLong": "This bookmark was not opened: its filters have more values or conditions than Strapi accepts. Open the list, narrow the filters, then save the current view in this bookmark.",
"notification.pinError": "The bookmark could not be pinned.",
"notification.pinned": "Bookmark pinned.",
"notification.saveError": "The bookmark could not be saved. Your changes are still in the form.",
Expand Down
6 changes: 6 additions & 0 deletions admin/src/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"filters.conditions": "Condiciones",
"filters.errorField": "Elija un campo.",
"filters.errorOperator": "Elija una condición.",
"filters.errorTooManyConditions": "Elimina condiciones hasta que queden como máximo {max}. Strapi no acepta más.",
"filters.errorTooManyConditionsAll": "Con «Todas las condiciones», usa como máximo {max} condiciones: la lista del Content Manager no se abre con más. Elimina condiciones o elige «Alguna condición».",
"filters.errorTooManyValues": "Introduce como máximo {max} valores. Strapi no acepta listas más largas.",
"filters.errorValue": "Introduzca un valor.",
"filters.false": "falso",
"filters.field": "Campo",
Expand All @@ -30,6 +33,8 @@
"filters.matchAll": "Todas las condiciones",
"filters.matchAny": "Alguna condición",
"filters.matchAnyHint": "Estas condiciones no aparecen como etiquetas de filtro sobre la lista.",
"filters.maxConditions": "Un filtro puede tener como máximo {max} condiciones, el máximo que acepta Strapi.",
"filters.maxConditionsAll": "Con «Todas las condiciones», un filtro puede tener como máximo {max} condiciones. La lista del Content Manager no se abre con más.",
"filters.noFields": "No hay campos coincidentes",
"filters.operator": "Condición",
"filters.remove": "Quitar la condición {number}",
Expand Down Expand Up @@ -106,6 +111,7 @@
"notification.invalidPath": "Este marcador no apunta a una vista de lista.",
"notification.linkCopied": "Enlace copiado.",
"notification.linkCopyError": "No se pudo copiar el enlace.",
"notification.listTooLong": "Este marcador no se abrió: sus filtros tienen más valores o condiciones de los que acepta Strapi. Abre la lista, reduce los filtros y guarda la vista actual en este marcador.",
"notification.pinError": "No se pudo fijar el marcador.",
"notification.pinned": "Marcador fijado.",
"notification.saveError": "No se pudo guardar el marcador. Los cambios siguen en el formulario.",
Expand Down
6 changes: 6 additions & 0 deletions admin/src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"filters.conditions": "Conditions",
"filters.errorField": "Choisissez un champ.",
"filters.errorOperator": "Choisissez une condition.",
"filters.errorTooManyConditions": "Supprimez des conditions pour n'en garder que {max} au plus. Strapi n'en accepte pas davantage.",
"filters.errorTooManyConditionsAll": "Avec « Toutes les conditions », gardez au plus {max} conditions : la liste du Content Manager ne s'ouvre pas avec davantage. Supprimez des conditions ou choisissez « Au moins une condition ».",
"filters.errorTooManyValues": "Saisissez au plus {max} valeurs. Strapi n'accepte pas de listes plus longues.",
"filters.errorValue": "Saisissez une valeur.",
"filters.false": "faux",
"filters.field": "Champ",
Expand All @@ -30,6 +33,8 @@
"filters.matchAll": "Toutes les conditions",
"filters.matchAny": "Au moins une condition",
"filters.matchAnyHint": "Ces conditions ne s'affichent pas comme étiquettes de filtre au-dessus de la liste.",
"filters.maxConditions": "Un filtre peut avoir au plus {max} conditions, le maximum accepté par Strapi.",
"filters.maxConditionsAll": "Avec « Toutes les conditions », un filtre peut avoir au plus {max} conditions. La liste du Content Manager ne s'ouvre pas avec davantage.",
"filters.noFields": "Aucun champ correspondant",
"filters.operator": "Condition",
"filters.remove": "Supprimer la condition {number}",
Expand Down Expand Up @@ -106,6 +111,7 @@
"notification.invalidPath": "Ce favori ne pointe vers aucune vue de liste.",
"notification.linkCopied": "Lien copié.",
"notification.linkCopyError": "Le lien n'a pas pu être copié.",
"notification.listTooLong": "Ce favori n'a pas été ouvert : ses filtres ont plus de valeurs ou de conditions que Strapi n'en accepte. Ouvrez la liste, restreignez les filtres, puis enregistrez la vue actuelle dans ce favori.",
"notification.pinError": "Le favori n'a pas pu être épinglé.",
"notification.pinned": "Favori épinglé.",
"notification.saveError": "Le favori n'a pas pu être enregistré. Vos modifications sont toujours dans le formulaire.",
Expand Down
Loading
Loading