Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

fix(vscode): Missing backend version in vscode #2035

Merged
merged 1 commit into from
Jun 23, 2023
Merged

fix(vscode): Missing backend version in vscode #2035

merged 1 commit into from
Jun 23, 2023

Conversation

lordrip
Copy link
Collaborator

@lordrip lordrip commented Jun 23, 2023

Context

Currently, there's a race condition caused between the KogitoEditorIntegrationProvider.tsx and the KaotoToolbar.tsx as the latter holds an outdated reference to the settings object, causing the backend version to be removed.

Changes

The fix is to use the correct API for the 'setSettings()' hook in which we only pass the property to be updated and nothing more.

Also, there's an icon property set in the settingsStore which causes the comparison to be slower than needed, as it holds the base64 representation of an image.

fixes: KaotoIO/vscode-kaoto#287

Currently, there's a race condition caused between 'KogitoEditorIntegrationProvider.tsx'
and the 'KaotoToolbar.tsx' as the latter holds an outdated reference
to the settings object, causing to the backend version be removed.

The fix is to use the correct API for the 'setSettings()' hook in which
we only pass the property to be updated and nothing more.

fixes: KaotoIO/vscode-kaoto#287
@lordrip lordrip requested a review from a team June 23, 2023 13:32
@@ -86,9 +86,8 @@ export const KaotoToolbar = ({
// fetch default namespace from the API,
useEffect(() => {
fetchDefaultNamespace().then((data) => {
const newSettings = settings;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was the main issue, in this hook, the settings object is outdated.

@lordrip lordrip requested a review from apupier June 23, 2023 13:32
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #2035 (c087805) into main (338904d) will decrease coverage by 0.03%.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##             main    #2035      +/-   ##
==========================================
- Coverage   65.07%   65.05%   -0.03%     
==========================================
  Files          87       87              
  Lines        2849     2847       -2     
  Branches      656      656              
==========================================
- Hits         1854     1852       -2     
  Misses        948      948              
  Partials       47       47              
Impacted Files Coverage Δ
src/components/AppearanceModal.tsx 88.23% <0.00%> (ø)
src/components/ThemeSwitcher.tsx 81.81% <0.00%> (ø)
src/store/settingsStore.tsx 100.00% <ø> (ø)
src/components/KaotoToolbar.tsx 54.54% <100.00%> (-0.41%) ⬇️
src/components/Visualization.tsx 74.52% <100.00%> (ø)

@apupier
Copy link
Contributor

apupier commented Jun 23, 2023

works in VS code:

image

@lordrip lordrip merged commit c47004b into kaoto-archive:main Jun 23, 2023
@lordrip lordrip deleted the fix/missing-backend-version-in-vscode branch July 10, 2023 11:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend version is missing from about dialog (main branch of Kaoto UI)
2 participants