sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

ReadOnly does not have any effect on package.json file

Open Marius-Adam opened this issue 2 years ago • 0 comments

Bug report

Packages affected

  • [ ] sandpack-client
  • [x] sandpack-react

Description of the problem

package.json is not set as readOnly. The file is still editable.

What were you doing when the problem occurred?

Using the SandpackProvider and passing the files as:

const files = {
    "/index.test.js": {
        "code": "import request from 'supertest';\nimport server from './index.js';...",
        "readOnly": true
    },
    "/index.js": {
        "code": "import http from 'http';\n\nconst hostname = '127.0.0.1';...",
        "readOnly": false
    },
    "/package.json": {
        "code": "{\n\"dependencies\": {},...}",
        "readOnly": true
    }
}

What steps can we take to reproduce the problem?

Navigate to sandbox/package.json and try editing the file. The file can be edited even if set to readOnly Observe missing 'read only' label

Link to sandbox: https://codesandbox.io/s/peaceful-drake-y4lr69?file=/src/App.tsx

Your Environment

Software Name/Version
Sandpack-client version -
Sandpack-react version 2.0.22
Browser Version 114.0.5735.198 (Official Build) (arm64)
Operating System macOS Monterey

Marius-Adam avatar Jul 14 '23 12:07 Marius-Adam