Skip to content
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

fix: broken new installs #389

Merged
merged 1 commit into from
Jan 24, 2025
Merged

fix: broken new installs #389

merged 1 commit into from
Jan 24, 2025

Conversation

cazala
Copy link
Contributor

@cazala cazala commented Jan 24, 2025

Fix Config Initialization and Recovery

Problem

We discovered a critical issue with config initialization:

  1. The analytics module in the main process creates a minimal config file containing only userId
  2. Later, when the renderer process tries to initialize the config, it skips creating the default config because a config file already exists (even though it's incomplete)
  3. This leads to missing critical config properties throughout the application, as the code assumes a complete config structure

This issue was introduced when analytics support was added a few versions back. It specifically affects:

  • New installations since that version
  • Does NOT affect existing installations that already had a valid config file
  • Persists across reinstalls since the config file is stored in the user's app data directory, outside the installation directory

This explains why the issue wasn't caught earlier - existing installations continued to work fine, while new users started experiencing problems with scene creation and template loading.

Solution

1. Proper Config Initialization and Recovery

  • Modified both main and preload processes to properly merge any existing config with default values
  • Even if a config exists (e.g., created by analytics with just userId), we ensure all default properties are present
  • Added deep merging to preserve existing values while guaranteeing config completeness

2. Implementation Improvements

  • Integrated deepmerge library for robust config merging
  • Centralized path handling in shared/paths.ts
  • Ensured consistent path resolution between main and preload processes
  • Standardized config initialization across the application

Testing

  1. Current Version (to verify the bug):

    # Windows
    Delete "C:\Users\<USERNAME>\AppData\Roaming\creator-hub\Settings\config.json"
    # Mac
    Delete "~/Library/Application Support/creator-hub/Settings/config.json"
    
    • Open Creator Hub
    • Observe that you cannot create new scenes and templates won't load
    • Note: Uninstalling/reinstalling doesn't fix this as the config file is preserved
  2. Fixed Version (this PR):

    • Uninstall current Creator Hub
    • Install the version from this PR
    • The app should work correctly
    • For new installations (the affected group), no additional steps needed
    • For existing users, you will need to re-import your scenes, but this is a one-time operation (because you deleted the config file where those imports were stored)

Migration

These changes are backward compatible and will automatically fix broken configs:

  • Existing configs with only userId will be automatically populated with all required default values
  • No user action or manual migration needed
  • Existing valid configurations will be preserved

Copy link

Test this pull request on windows-latest

Download the correct version for your architecture:

win-x64

Copy link

Test this pull request on macos-latest

Download the correct version for your architecture:

mac-arm64
mac-x64

Click here if you don't know which version to download

For running this unsigned version of the app, you will need to run the xattr command on it:

  1. Extract the app from the downloaded .dmg file (double-click it)
  2. Place the extracted app anywhere you like in your file system
  3. Open a terminal on the directory where the app is
  4. Run xattr -c app-name, replacing "app-name" for the actual name of the app
  5. Double-click the app ✅

@Ludmilafantaniella Ludmilafantaniella self-requested a review January 24, 2025 17:35
Copy link

@Ludmilafantaniella Ludmilafantaniella left a comment

Choose a reason for hiding this comment

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

🟢 Fix verified on Windows and Mac:

Steps to Validate:

  1. Installed the previous version (v11.5).
  2. Deleted ~/Library/Application Support/creator-hub/Settings/config.json.
  3. Verified the issue: unable to create new scenes.
  4. Installed the fixed version (v11.6).
  5. Confirmed the fix:
    *Scenes can now be created successfully.

Validation complete; issue resolved in v11.6.

@cazala cazala merged commit a8780c9 into main Jan 24, 2025
10 checks passed
@cazala cazala deleted the fix/empty-config branch January 24, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants