CSV/datagrid doesn't save rows

Open
#146 5 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@hunvreus is already working on this.

Since Mar 8, 2025.

Assessment

This issue has not been assessed yet.

Description

bug

I'm testing out migrating to PagesCMS (thank you--great product and exactly the right fit for me) from a 'no-cms' solution of Markdown and CSV files.

I've hit a snag testing out the CSV integration. The configuration saves and provides a UI to add new records. It correctly creates the CSV file. However on saving nothing is written to the file (it stays empty).

I've tried with JSON which seems fine. Removing the format: datagrid does write to the file but in an unexpected format (a markdown header).

I'll try running a local copy to try and debug further.

Doesn't write to file:

  - name: exhibitions-test-csv
    label: Exhibitions (test CSV)
    type: file
    format: datagrid
    list: true
    path: src/data/Exhibitions-test.csv
    fields:
      - name: Year
        label: Year
        type: number
      - name: Title
        label: Title
        type: string

Writes to file with a strange format:

  - name: exhibitions-test-csv
    label: Exhibitions (test CSV)
    type: file
    list: true
    path: src/data/Exhibitions-test.csv
    fields:
      - name: Year
        label: Year
        type: number
      - name: Title
        label: Title
        type: string
---
- Year: 1991
  Title: TEST
- Year: 1992
  Title: TEST 2
---

Writes to file and correcty formatted:

  - name: exhibitions-test-json
    label: Exhibitions (test JSON)
    type: file
    list: true
    path: src/data/Exhibitions-test.json
    fields:
      - name: Year
        label: Year
        type: number
      - name: Title
        label: Title
        type: string
Dominant language
TypeScript
Stars
4.1k
Forks
564
Avg merge
8m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hunvreus/pagescms

All issues in hunvreus/pagescms

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.