Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(web): plugin playground/reflect code editor to viewer #1224
base: main
Are you sure you want to change the base?
feat(web): plugin playground/reflect code editor to viewer #1224
Changes from 33 commits
3c377d0
362287b
642c6c8
bd6cc93
ae44b45
93718e9
a2d2b01
02ce6eb
50b7be2
f62b092
f395ee2
ac0bab4
00ddfa7
a389041
ee060e0
fb316e2
f29eed2
e97cdb0
ff7229a
e2b6480
4ceecdd
6270b1a
e7d4c3d
b6a5505
e1f81d5
90f337c
df4ca9d
1dd6c93
1bec19e
9bc0153
3f0d214
031c2ab
e15c4d8
15c1a61
6e10a0e
cceb0bc
13a74cc
f940da6
b7b7915
3b75842
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
🛠️ Refactor suggestion
Add error notification when no YAML file is found
Currently, if no YAML file is found in the provided files, the function returns silently without notifying the user. It would be helpful to inform the user that no YAML file was found to provide better feedback.
Apply this diff to add an error notification:
if (!ymlFile) { + setNotification({ type: "error", text: "No YAML file found." }); return; }
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.
🛠️ Refactor suggestion
Ensure that
ymlJson.extensions
is a non-empty array before proceeding.Before using
ymlJson.extensions
, it's good practice to verify that it's a non-empty array to prevent runtime errors.Apply this diff to add the check:
📝 Committable suggestion
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 could add this just to double-check
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.
@mulengawilfred, sounds good! Adding this check will help ensure that
ymlJson.extensions
is a non-empty array before proceeding, which will prevent potential runtime errors.If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
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.
🛠️ Refactor suggestion
Avoid using spread syntax on accumulators within
reduce
to enhance performance.Using the spread operator (
...
) on the accumulator inside areduce
function can lead to O(n²) time complexity, negatively affecting performance.Refactor the code to mutate the accumulator directly:
This approach avoids unnecessary object spreads and enhances performance.
📝 Committable suggestion
🧰 Tools
🪛 Biome
[error] 108-108: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.Consider methods such as .splice or .push instead.
(lint/performance/noAccumulatingSpread)
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.
Worth considering this change as well
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.
@mulengawilfred, glad you find the suggestion helpful. Let me know if you have any questions or need further assistance.