feat(RND-104): add support for loading color preset from json#2100
feat(RND-104): add support for loading color preset from json#2100asvishnyakov wants to merge 5 commits intodevfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for dynamically loading color presets from JSON files stored in the /assets/presets directory, providing flexibility for runtime theme customization without requiring bundle rebuilds.
Key Changes:
- Made
addPresetToThemeContextandgetPresetfunctions asynchronous to support fetching presets from external files - Implemented a three-tier loading strategy: bundled presets → runtime cache → fetch from
/assets/presets→ fallback to default - Added runtime caching via
dynamicPresetsCacheMap to avoid redundant network requests
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| client-app/core/composables/useThemeContext.ts | Implements async preset loading with fetch API, adds caching mechanism, and provides fallback logic to default preset |
| client-app/app-runner.ts | Updates preset loading call to properly await the now-async addPresetToThemeContext function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
client-app/core/composables/useThemeContext.ts:100
- The nullish coalescing assignment on line 94 already ensures preset will never be null after this line. The subsequent if-else block checking if preset exists (lines 96-100) is redundant since preset will always be truthy after line 94. Consider removing the else block and the conditional check, or restructuring the logic for clarity.
preset ??= presets.default;
if (preset) {
themeContext.value.preset = preset;
} else {
throw new Error("Missing preset");
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot You first overview outdated, update it |
|
@asvishnyakov I've opened a new pull request, #2102, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
|
Please ignore Copilot overview - it's outdated and Copilot is stupid enough to not being able update it |



Description
This PR adds support for loading color presets from JSON.
assets/presetsfolder. The folder name can be changed upon request if needed.Fallback logic has changed after AI review:
Before:
a. Dead code lead to missed attempt to use current preset from settings
b. This is probably a bug. Try to define non-existing preset in white labeling and then see theme falling back to default preset instead of the one specified in
currentfield ofsettings_data.jsonAfter:
References
Jira-link:
Artifact URL:
https://vc3prerelease.blob.core.windows.net/packages/vc-theme-b2b-vue-2.37.0-pr-2100-c9d0-c9d02f4f.zip