Skip to content

Conversation

Isaac799
Copy link
Contributor

This is my first time contributing (ever). I like this project and want to help. Open to feedback.

Workspace existence seems important, and the ux is not very tolerant of it missing. My goal is to ensure one exists.

The lack of a workspace caused a nil deref here. This happened to me when first launching chapar, preventing usage. I replicated it with rm -rf ~/.config/chapar/.

To remedy the issue I:

  • ensure a workspace is created if none exist on startup
  • prevent the user from deleting their active workspace

Notice lack of the delete button on "New Workspace_3"

Screenshot From 2025-07-12 14-49-51

return nil, err
}
if len(workspaces) == 0 {
workspace := domain.NewWorkspace("New Workspace")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use domain.DefaultWorkspaceName as name then it will be by default protected from removal and edit.

See:

readonly := item.MetaData.Name == domain.DefaultWorkspaceName

And

if item.readOnly {

@mirzakhany
Copy link
Collaborator

mirzakhany commented Jul 13, 2025

Thanks for the PR and fixing the issue, overall looks good, just one change would be to use the domain.DefaultWorkspace when creating the first workspace. I like the Idea of preventing deletion of active workspace.

@mirzakhany mirzakhany merged commit 796546b into chapar-rest:main Jul 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants