-
Notifications
You must be signed in to change notification settings - Fork 53
Sync site list when CLI creates sites while app is running #2313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/studio-cli-i2
Are you sure you want to change the base?
Sync site list when CLI creates sites while app is running #2313
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test STU-1164 (Site creation)
Worked as expected
- Run node dist/cli/main.js site set-domain hello.wp.local --path PATH_TO_SITE
The changes are not reflected in Studio, tested a few times and reinstalled node_moduels and rebuild
set-php-version
Also changes are not reflected in Studio
set-wp-version
Stucks endlessly on Changing WordPress version… and can't be termninated with controll+c
UPDATE: I got error and again it stucks:

|
thanks for the review @nightnei I couldn't replicate any of the issues, can you run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works as expected 👍
Looks like something was wrong locally for me when I tested before
sejas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We removed and introduced the useIpcListener( 'user-data-updated' listener multiple times in the past. See:
I understand this is a good way to update the Studio UI from external changes, such as the CLI creating a new site, although I wonder why we removed it in the first place.
sejas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works as expected. Great work! I confirmed that the site appears automatically in the left sidebar when creating a new site with the Studio CLI. I also tested node dist/cli/main.js site set-domain hello.wp.local --path /tmp/test-site-cli and node dist/cli/main.js site set-php-version 8.4 --path /tmp/test-site-cli.







Related issues
Proposed Changes
useIpcListenerforuser-data-updatedevent inuse-site-details.tsxto refresh the site list when the appdata file changes externally (e.g., when CLI creates a site or modifies site settings)Root cause: The file watcher (
user-data-watcher.ts) already broadcastsuser-data-updatedIPC events when the appdata file changes, butuse-site-details.tsxwas not listening to this event. The snapshot slice listened to it for preview sites, but the main site list did not.Testing Instructions
Test STU-1164 (Site creation)
npm run cli:buildnode dist/cli/main.js site create --path /tmp/test-site-cliTest STU-1163 (Site settings changes)
node dist/cli/main.js site set-domain hello.wp.local --path PATH_TO_SITEset-php-version,set-wp-version,set-httpsPre-merge Checklist