Skip to content

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 16 Nov 08:26
· 28 commits to main since this release
588d370

Major Changes

  • b7c6b83: Breaking: the index no longer re-exports the internal helpers nor the testing tools: these names can no longer be imported from react-resource-view, their code stays in its module

    Removed from the index, to be released with version 2.0.0:

    • onResourceViewDefaultsChange (marked @internal) and getRegisteredOpenFrames
    • BUILT_IN_OPEN and resolveOpen
    • adoptResources and useInlineClaim
    • writeOptimistically, isOptimistic and notifyWriteError
    • joinPath, appendBracketParam and flattenStrapiRecord
    • PermissionCacheContext
    • resetApiConfig, for tests
    • Header and ContentList, internal components of the list view (names that collided with the router's)

    None of these names is used by the documentation or the website. @internal declarations no longer appear in the published .d.ts files (stripInternal). A test now freezes the list of public exports: any addition or removal changes it.

Minor Changes

  • 150902e: Added: commandPalette on AdminLayout / createAdminLayout opens a Cmd+K / Ctrl+K palette built from the scope — go to a menu entry, start a creation — and lists only what the resources permit, instead of leaving the back office without keyboard navigation.

    • commandPalette: { searchable: true } also looks records up by the titleField of each resource, sent as a filter like the list's own.
    • The palette is a role="dialog" holding a combobox and a listbox; Escape closes it.
  • 51a6912: Changed: afterSave: "read" on views.create and views.update leads to the page of the saved record, and useFormByResource fills the form itself when the record arrives, instead of a view copying the synchronisation of EditView

    • "read" is accepted by the development validation next to "close", "stay" and "reload".
    • A form handed a data of its own (a row of a list) keeps that record and is not refilled.
  • 5fb8020: Changed: layout.board({ groupBy: "status" }) draws one column per option of the form's status input, instead of asking for columns next to the options it already declares

    • columns stays available to reorder the columns or show only some of them.
    • In development, a board without columns is refused only when the input it groups by has no options to read them from.
  • 37179f8: Added: layout.board({ columns }) accepts a function ({ viewResourceContext, rows, defaults }) => columns, read again at each render, and hideEmpty (on the board or on a column) hides the columns holding no card except while a card is dragged, instead of replacing the whole board list component to do either

    • defaults are the options of the form's input the board groups by.
    • "Move to…" still lists every column, hidden or not.
  • 6d40944: Changed: below sm, the calendar's month view shows the initials of the days, one dot per event and the list of the tapped day underneath, instead of titles cut to "02:" in 44 px cells.

  • f5a2886: Changed: layout.cards({ frame: false }) draws components.row on its own, without border, padding or actions footer, and actions: false removes the actions footer of a framed card, instead of always wrapping the row in a card of its own

    • A row component that already draws its own card no longer gets a double frame; selection and opening keep working.
    • The codemod writes frame: false on cards whose cardViewOptionFactory had a rowComponent.
  • 82bd6e2: Added: createPage("help", { name, icon, component }) declares a page without data (a home, a help, a dashboard): a menu entry and a route to a component, with no create, read, update or delete route and no request to the API, instead of a createViewResource with every permission turned off and a fake getCollection.

    • migrate writes a 0.x resource made only of a name, an icon and a viewComponent as createPage, and no longer reports RV1-PERM-002 on it.
  • 029a3d9: Changed: in development, a tab with neither resource nor component or whose resource is an unknown id, a layout.chart() with neither groupBy nor dateField and a layout.cards({ columns }) outside 1 to 6 throw an explicit error, instead of passing silently.

  • 31915ba: Added: ChartAggregate, ChartInterval, BaseJsonLdItemInterface and DefinitionProblem types are exported, as is inspectDefinition, which lists the problems of a declaration without throwing, so it can be tested in CI. The README shows a vitest example.

  • 7f556f2: Added: npx react-resource-view generate resources writes one resource declaration per collection of the OpenAPI schema, instead of leaving every createViewResource to be written by hand after init

    • Reads OpenAPI 3.0/3.1 and Swagger 2.0 (API Platform, FastAPI, Supabase…) from a file or a URL — by default src/api-schema/openapi.json.
    • Writes the path, the form.inputs (enums as selects, IRIs and foreign keys as searchable relations, dates, numbers, booleans), the permissions the exposed operations allow, a table, and a board when an enum named status is among the inputs.
    • Registers the resources in the scope's resources; --only books,authors restricts them, --dry-run lists the files, and no existing file is overwritten without --force.
  • 7b8b0b7: Added: react-resource-view/i18n exports messages, the English reference of every message the library shows, and missingKeys(dictionary), which lists the keys a dictionary leaves untranslated, instead of copying the keys by hand into each project

    • messages is keyed on the English text: messages["Saved"] === "Saved". A dictionary for another language has one entry per key.
    • missingKeys returns the keys without an entry, and those with an empty one. Call it from a test to fail when a new version of the library adds a message your dictionary does not translate.
    • The documentation has an "i18n" page that shows how to merge the catalogue with your own keys.
  • 5ca6970: Added: layout.gallery({ imageField }) draws a grid of cards headed by a picture, for products, articles or profiles

    • imageField is typed on the item and accepts an URL, a data URL, a media object ({ url, name }) or a list of them; a record without an image gets a placeholder, and the pictures load lazily.
    • aspect ("4/3", "1/1", "16/9"), fit ("cover", "contain"), titleField, columns and fields shape the cards.
  • 7744b2b: Changed: below sm, the layout switcher shows the icon of each layout alone (its name stays the tab's accessible name), instead of cutting the last tabs off at 390 px.

  • a0855d0: Changed: an empty list tells "nothing yet" from "nothing matched", draws the resource's own icon and name, and offers to clear the filters when one is active, instead of always saying "Nothing matched your search"

    • New views.list.empty: { icon, title, body, filteredTitle } declares them without a component; icon defaults to the resource's icon, title to "No yet".
    • The create button only shows where permissions.create allows it.
    • components.empty still replaces the whole state.
  • 5d87b71: Added: two media controls, createMediaImageInput (one image: preview, replace, crop, remove) and createMediaFilesInput (a list of documents: name, type, size, preview or icon, download, removal), which keep the file as base64 in the record instead of requiring an upload API

    • Options: accept (MIME types, image/* families or extensions), maxSize, maxFiles, dragAndDrop, crop: { aspect }; a refused file is named under the field with the reason, through react-mini-i18n.
    • store changes what becomes of a file: a data URL by default (storeAsDataUrl), or the URL returned by a function that sends it to the API.
    • components: { dropzone, imagePreview, fileItem } replaces part of the rendering; mediaImageInputControllerFactory and mediaFilesInputControllerFactory set these options once for the whole application.
    • Outside a form, MediaValue shows a thumbnail for an image and an icon with the name for a document: on a detail page, in a table cell (two files then "+N") and on the cards, instead of the raw base64.
  • fba905e: Added: mobileNavMaxItems on AdminLayout / createAdminLayout (4 by default) caps the entries of the mobile bottom bar; the following ones move into the "More" drawer, ahead of footerMenu, and "More" is marked current when the page on screen is one of them.

  • c93ffa0: Changed: a burst of realtime pushes is read once, 250 ms after the last one (realtime: { debounce } to change it), and a read that a newer one replaces, or that the unmount outlives, is aborted: ResourceContext carries a signal that the REST repository passes to fetch, instead of five full reads of the list whose stale answers were only dropped on arrival.

  • 7e51ed8: Added: realtime accepts { subscribe, withCredentials }: the channel is pluggable (Supabase Realtime, SSE, WebSockets), and Mercure reconnects with a growing delay and reads the views again when the hub comes back, instead of closing for good after an HTTP error.

  • 365ffc7: Changed: a hand-written repository answers { items, totalItems } and always receives { id: string }, instead of a JSON-LD collection and an id that was sometimes the item, the IRI or the bare segment

    • getCollection accepts { data: { items, totalItems, nextCursor? } } without a cast; createResourceCollection and JSON-LD collections still work.
    • getItem and removeItem receive { id } and updateItem the record with its id, always the short identifier as a string. A repository that read the @id of the item it was given must read id instead.
    • New idField on the resource: links, keys and selection are built from that field, so the records need no @id.
  • f454c8e: Added: restDialect describes a common REST API through configuration (X-Total-Count, Link header, cursor pagination), with the jsonServerDialect and drfCursorDialect presets and init -b json-server, instead of requiring a hand-written dialect

  • 8c15035: Changed: below sm, the table's row actions fit in a 56 px "…" menu instead of two text buttons that took half the screen

  • 6e5b079: Added: views.list.savedViews: true adds tabs of saved views above a list — a name over its filters, sort, layout and columns, created, renamed, duplicated and deleted by the reader — and views.list.presets declares typed ones in code, instead of a combination that cannot be named nor linked to

    • A view has a URL: ?savedView=<id> applies it, next to the filter and variant it sets.
    • The views a reader saves are kept by the new savedViews port of configurePorts: localStorage by default, or four functions (list, create, update, remove) to share them through an API. SavedViewsStoreInterface, SavedView, ListPreset and localSavedViewsStore are exported.
    • In development, a preset without a name, with an undeclared layout or with the id of another is refused.
  • b99a241: Added: singleton: { get } or singleton: { id } declares a resource with a single record (settings, a profile): its menu entry opens update (or read) directly, and draws the creation form, pre-filled with defaultData, when the record does not exist, instead of a hand-made list filtered down to at most one item.

    • get(context) resolves to the record, or to undefined / null when there is none; with id, a 404 from the API means the same.
    • Saving a new record stays on the page and turns it into the editing form; afterSave still applies.
  • 9389c47: Added: storage: { type: "local", seed: Item[] | () => Item[] } fills a resource kept in the browser with its first records, written once and only while the storage is empty, instead of writing the Hydra collection into the storage key by hand

  • d9904d0: Changed: the submit button of a form reads "Save" on an edit screen and "Create" on a creation one, instead of the name of the action ("update"), so label.submit is no longer needed to get those words

    • A label.submit declared in the form still wins.
  • 3a3d897: Added: layout.table({ groupBy }) and layout.cards({ groupBy }) section the rows by a field, one foldable section per value with its count

    • The sections are headed by the labels of the options of the form's select input, in its order; the records with no value are gathered under "No value", last.
    • Each header is a button with aria-expanded; every section starts open.
    • The Properties menu of the table gains a "Group by" choice among its select fields, remembered per resource and layout like the columns.
    • Only the page on screen is grouped, and a note says so when the API holds more records.
  • 12cda5e: Added: three new list layouts — layout.tree() (each record under its parent, collapsible branches), layout.map() (one marker per record on tiles from any server, with no new dependency) and layout.chart() (count, total, average and bars per value or columns per period), all API-agnostic

Patch Changes

  • a1e6df0: Fixed: the JSON-LD dialect reads hydra:title, hydra:description and hydra:violations (API Platform 3's default error format), instead of showing a 400 error with no explanation.

  • ddcfbd5: Fixed: ApiUri shows a fallback instead of an endless loader when the relation responds with an error, noCache rereads an iri that is already cached, a changed iri is picked up, and the cache is invalidated when the linked resource publishes onChange.

  • c0e6c5f: Fixed: hooks.beforeList receives the view's filter already merged and has the last word, instead of seeing the filter added after it returned (a search renamed to q went out with both keys, a removed key came back)

  • cd56907: Added: a resource can let a board's cards be moved without offering the update form (permissions: { update: false, move: true }), instead of locking the cards as soon as update is refused

    The new move permission answers as update does as long as it is not declared: nothing changes for a resource that does not mention it. The migrate codemod puts a TODO(RV1-PERM-008) on update when canUpdate is refused on a declaration that draws a board — in 0.x, its cards moved anyway. Documented in MIGRATION-1.0.md and migrations/1.0.json.

  • 12ac31e: Fixed: on a board, records whose groupBy matches no column (null, unknown value) fall into a "No value" column (showUnassigned, unassignedLabel), and 1 finds the "1" column, instead of disappearing without a sign.

  • f1a5d93: Fixed: clicking a day of the calendar opens the create view, with the date filled in and no id, where views.create.open says, instead of adding a second "create" link under the calendar

  • 36058f2: Fixed: the month's cells and the calendar's week and day slots create a record from the keyboard (Tab, then Enter or Space), and the Day/Week/Month tabs keep their label for screen readers on a phone, instead of being click-only divs and tabs reduced to an icon

  • a268b11: Fixed: the calendar's month view names its days from the locale's first day of the week (Sunday in en-US), instead of staying fixed from Monday to Sunday above columns that start elsewhere.

  • ae49b69: Fixed: a word that is not a command (migrat, wombat) exits with code 1 and suggests the closest command ("Unknown command "migrat" — did you mean migrate?"), instead of creating src/views/migratLayout.tsx; help prints the help instead of creating helpLayout.tsx

    help [command] and --version / -v work, and the help lists the options under the command they belong to. The shortcut without a command (npx react-resource-view Heatmap) still works, but only for a name that starts with a capital letter.

  • 526f4af: Fixed: configureApi's baseUrl, fetch and getHeaders also apply to the default JSON-LD dialect, and baseUrl and getAuthToken reach Mercure, instead of being ignored

  • f6df599: Fixed: the CSV export prefixes with an apostrophe the cells that start with =, +, -, @, a tab or a carriage return, instead of letting Excel or LibreOffice run them as formulas when the file is opened (CSV injection, OWASP); the JSON export is unchanged

  • 2c5d64b: Fixed: a custom dialect that reads payload.rows fills the list, instead of showing it empty because it read the already normalized envelope again

  • 881724a: Fixed: with FastAPI, Django or Spring and a primary key other than id, opening a record calls GET /articles/hello, instead of the collection's URL

  • 539bf18: Fixed: in the calendar and the timeline, a date without a time (2026-10-23) falls on the right day in every time zone and is shown without a time, instead of being read as UTC ("02:00", or the day before in the Americas)

  • 96f33b5: Changed: a development error points to MIGRATION-1.0.md and npx react-resource-view migrate only when it reports a 0.x key, instead of ending every error — a typo in a 1.x declaration included — with it

    • An option a layout names differently is suggested under its name there: layout.timeline({ dateField }) suggests startField (and layout.calendar({ startField }) suggests dateField), instead of the closest spelling, titleField.
    • A misplaced groupBy lists layout.chart({ groupBy }) among the layouts that take one.
    • The hint for titleKey (RV1-VIEW-008) names the layouts that take a titleField — board, gallery, calendar, timeline, tree and map — instead of "on a layout", which layout.table({ titleField }) refuses.
  • 91a91b2: Fixed: a resource declared before configureApi({ dialect }) speaks the configured dialect, instead of staying on JSON-LD forever

    createRepository chose between the JSON-LD repository and the REST repository when the resource was declared. Resources being declared by imported modules, hence before the body of the entry point that calls configureApi, a Strapi or Supabase application split across several files spoke JSON-LD without a word. The choice is now made on every request; a resource that declares its own dialect keeps its backend.

  • 5ce21a3: Fixed: field names (titleField, groupBy, form.inputs…) are also checked on an item that extends BaseJsonLdItemInterface, instead of accepting any string because of its index signature.

  • d68099f: Fixed: changing a filter brings the list back to page 1, instead of keeping the current page and showing "No results yet" without pagination

  • 8f130e1: Changed: the keys of form.inputs are checked against the item: inputs: { titel } is a TypeScript error, instead of compiling silently. A field that does not exist on the item (a password confirmation…) is declared in the second generic, createViewResource<User, User & { confirm: string }>; filters.inputs stays free, and the README says so.

  • 73641d2: Fixed: init -b supabase -u https://<ref>.supabase.co fills SUPABASE_PROJECT_REF in .env from the URL, and ends on make api-schema (which reads .env) instead of pnpm run api-schema, which failed on the empty project id

  • 5eb82e3: Fixed: on an items or tree layout, a record still being created shows no action buttons, as a table row does, instead of offering update and delete on a row that has no identifier yet.

  • a25d0ec: Fixed: createViewResource<Row> accepts the real type of a Supabase, Strapi, FastAPI, Django or Spring row, without "@id", instead of refusing the type or pushing to lie about it

  • c647ac0: Fixed: on the default JSON-LD backend, an array filter goes out as status[]=a&status[]=b, instead of status=a&status=b, of which API Platform kept only the last value

  • 3643c38: Changed: in development, a JSON-LD path without a leading / throws an error instead of targeting the wrong host, and realtime: true on a path outside /api/ warns that it subscribes to nothing, instead of staying silent.

  • 4a59a6c: Fixed: the JSON-LD dialect returns ids as strings, so a custom repository answering { id: 5 } no longer crashes layout.split() with id.split is not a function.

  • 0f48e26: Changed: switching layouts writes variant=<id> into the URL, as filter does, instead of keeping it in memory only: a reload or a shared link finds the chosen layout again. A list nested in a tab leaves the URL alone.

  • 4313bb0: Fixed: the board, calendar, timeline and split layouts show the pagination, instead of stopping at the first page with no way to reach the other records.

  • ebd65f1: Changed: createViewResource alone weighs under 50 kB minified instead of 191 kB: the layouts, the views and the dialog/drawer frames are loaded the first time they are drawn, not bundled by every resource declaration.

  • edc83ac: Fixed: the list always sends its page size (30 without views.list.pageSize), instead of letting Spring answer 20 rows and Strapi 25 while the pagination counts 30

  • c675ade: Fixed: storage: "local" paginates and sorts on the client instead of emptying the list and the export as soon as pageSize, a sort or page enters the filter

  • dcb927e: Fixed: a malformed ?filter= or ?defaultData= in the URL is ignored (with a warning in development) and the view is shown, instead of throwing a SyntaxError that brought down the whole ResourceViewProvider

  • 3cc2138: Fixed: the migrate codemod rewrites tableViewOptionFactory() without an argument to layout.table(), and a factory called with a variable to layout.cards(opts) flagged for a manual review, instead of crashing on a TypeError that does not name the file

    A file the migration cannot read or rewrite is now named with its error and left as it is; the other files are processed anyway, and the command ends with code 1 — the project is no longer left half migrated without knowing where.

  • 558c450: Fixed: the migrate codemod exits with code 1 on a path that does not exist and processes .mts, .cts and .cjs files, instead of announcing "0 files rewritten." and letting --check pass in CI

    Errors (unknown option, missing path, file that cannot be migrated) are written to stderr, no longer to stdout.

  • 820b0f3: Changed: Button, Badge and TabsTrigger transition only their colors, border, shadow and transform, instead of every property

    • transition-all becomes transition-[color,background-color,border-color,box-shadow,transform], as in the Brand Assets design system. Size and layout changes (a width set by the application, for instance) are no longer animated.
    • The default theme sets --heading-weight to 600 and --heading-tracking to −0.02em, instead of 800 and −0.025em: headings are lighter.
  • fd9f63e: Fixed: a page beyond the last one (after a deletion or through a ?filter={"page":50} link) brings the list back to its last page, instead of an empty screen without pagination.

  • f0c281e: Fixed: the pagination's ellipses are no longer buttons, instead of sending page "...." to the API

  • f64d535: Fixed: under prefers-reduced-motion: reduce, dialogs, alert-dialogs, popovers and selects no longer grow when they open: they only fade

  • 0331468: Fixed: setSelected, isSelected and onSelected select a record by the identity the dialect reads, instead of accepting only those that have an @id (Strapi, Supabase, FastAPI, Django, Spring)

  • e59fe0a: Fixed: the delete view is shown on a full page (direct route …/delete/1, views.delete.open: "page") instead of throwing DialogRootContext is missing, and "Cancel" goes back to the list there.

  • 37c3c5a: Fixed: the delete view shows the loading error with "Try again" when the record does not load, and "Continue" is disabled during the call, instead of leaving the dialog empty and sending two DELETE requests

    A failing getItem (404, 403) left the body of the dialog empty, with no message and no way back. With views.delete.optimistic: false, a double click on "Continue" sent two DELETE requests: the button is now disabled during the deletion, in its destructive variant, and becomes active again if the API refuses.

  • f52b205: Fixed: views.list.rowActions rejects ActionList.create and ActionList.list at compile time, as it already rejected "create" and "list", instead of accepting them. Only read, update and delete are accepted, written as strings or as the enum.

  • 1122220: Fixed: the links of the row actions, the split, the timeline, the calendar and the chart carry the identifier read by the resource's dialect (Strapi's documentId, Supabase's primary key), instead of the global dialect's

  • ef6aa16: Changed: the selection checkboxes of the table, cards, items, tree and gallery are named "Select <title>" (from titleField, then title, name, label, then the id) and the table's actions column header carries a screen-reader "Actions" label, instead of every checkbox being called "Select" and the header being empty

  • 769452a: Fixed: in a list, the bulk action bar only appears in the layouts that have a selection (table, cards, items, tree, board, or a layout.custom that declares supports: ["selection"]); when switching to the calendar, the map… the selection is set aside instead of staying active on invisible rows.

  • 8547004: Fixed: a selection is cleared when the page, the filter or the sort changes, instead of reappearing on the way back to the page with a bulk action ready to act on it

  • 65c817a: Fixed: in the split layout, "Back to the list" closes the detail and the id follows the URL (the Back button included), instead of leaving the detail shown on a phone.

  • 1635b86: Changed: list rows (table, cards, items, split) are keyed by the identity of their record instead of JSON.stringify or the index, so an edited or optimistically created row keeps its DOM node, focus and local state.

  • 7af1a17: Changed: the starter generated by init splits React, the router and the UI dependencies into their own chunks, so its first vite build ends without the "chunks are larger than 500 kB" warning, instead of one 687 kB entry chunk.

  • bd6c10a: Fixed: the sticky row-actions column of the table took the page's colour instead of the card's, drawing a darker band from the header down, ignoring hover and selection and overflowing the card's rounded corner; it now follows the card and the row, its shadow only shows while the table scrolls, and Delete is muted until hovered, with a gap between the buttons

  • 2d490ee: Fixed: on a timeline, a groupBy field holding a number or a boolean (0 and false included) forms one group per value, instead of putting every row in "Unassigned".

  • 20ddfba: Fixed: an unknown resource throws Resource "x" is not registered. Registered: … and an action without a view Resource "x" has no "update" view. Available: …, instead of "View not found" in both cases

  • 80e1146: Fixed: without a total returned by the API, the list offers "Previous / Next" and the export reads every page, instead of believing it has only one page

  • 0085a9f: Fixed: a view refuses an identifier from its URL that is the IRI of another resource or an absolute URL, and shows a load error, instead of reading — and saving — whatever the IRI designates (/books/update/%2Fapi%2Fusers%2F1 called GET /api/users/1)

    • An identifier holding a slash is accepted only as an IRI one segment under the resource's path.
    • The JSON-LD dialect no longer calls an absolute URL given as an id, which would have sent the bearer token to that host.
  • b5b04c9: Changed: the development validation checks the values of rowActions, open, afterSave, pageSize, permissions and layouts, and reports a table declared without form, instead of letting them fall back silently on a default.

  • 69e6232: Changed: the development validation cross-checks groupBy, fields, sort.fields and titleField against form.inputs: statuss or titel give a "did you mean … ?" warning instead of passing silently (a warning, to let computed fields through).

  • c53ceeb: Changed: the development validation also checks the keys of form, filters and sort: inptus, intial or feilds throw "did you mean … ?" instead of being ignored without a word.

  • f8c071c: Fixed: the pagination and the views' labels go through the dictionary, with English keys, instead of staying in French or hard-coded — the half-translated "Showing 1 to 30 of 31 results" becomes a key with variables

  • f799450: Changed: a write that fails without an answer says "The server could not be reached.", and one the API refuses without a detail (an HTML 500) shows its status, instead of a bare "An error occurred"

    The toast of useResourceMutation and the one of the forms now follow the same rules as the load error: the API's detail when it gave one, else " — The server answered with an error.", else, for a fetch that never got an answer, "The server could not be reached.".