Publishing a page deletes custom Vue component files from the app

Open Beginner friendly
#321 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, python

Research direction

Start with StudioPage.delete_unused_component_files() in the code added by commit 3b1017f1, then trace how the studio_components folder is handled during page publishing. Check that unused Studio Component files are removed while custom .vue files remain. Done means publishing a page changes only its files and preserves the app’s custom Vue components.

Written by the indexing model from the issue text.

Description

Issue

When I publish a page of a standard app in developer mode, Studio deletes every custom Vue component file (*.vue) in the app's studio_components folder.

Steps to reproduce

  1. Use a standard Studio app that has custom Vue components in <app>/studio/<studio_app>/studio_components/. For example, Connect has 15 .vue files there.
  2. Turn on developer mode.
  3. Open any page of the app in the editor and click Publish Page.
  4. Run git status in the app.

Expected result

Only the published page's files change.

Actual result

All .vue files in studio_components are deleted. In Connect, this removes the sidebar header and footer, settings, notifications, and other components. If the deletion is committed and deployed, those parts of the app stop working.

Cause

StudioPage.delete_unused_component_files() (added in 3b1017f1) keeps only the files whose name matches a Studio Component used by a page of the app:

if file.removesuffix(".json") not in used:
    delete_file(folder, file)

Custom Vue components are files in the same folder, not Studio Component records, so they never match used and are always deleted. The editor loads these components from this folder, so the files are in use.

Suggested fix

Delete only .json files of unused Studio Components, or skip .vue files.

Environment

  • Studio: develop at 5b9d70a5
  • Developer mode: on
Dominant language
Vue
Stars
293
Forks
109
Avg merge
15h 57m
Merged PRs (30d)
3

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 frappe/studio

All issues in frappe/studio

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.