Closed da-h closed 1 year ago
I am sorry for the back and forth here with the draft-ing/undraft-ing. With the current submission, however, I am confident that I have not missed anything else. :sweat_smile:
I look forward to read your review of the PR. If you have any suggestions on how we can improve the proposed changes, please let me know.
Description
This PR refactors server-related functions in the client code by moving them into the
js/api/ApiProvider.js
component.Also:
sendPaneMessage
andsendEmbeddingPop
by addingtargetId
andenvID
as arguments, making the code more versatile for pane-functions that trigger server messages when not selected. However, no changes in user functionality have been made.sendSocketMessage
calls with specialized versions for improved code readability and maintainability.sendX
: Functions send data or queries to the server. Normalized naming tosendNounVerb
for an improved autocompletion experience.onX
: Functions that are called when the server sends something to the client, aligning with event naming conventions.Motivation and Context
The aim was to enhance code readability and reduce the lines of code in
main.js
. UsinguseContext
has simplified the use of API functions in child components. Previously, these functions needed to be forwarded in the JSX calls, but now they can be accessed globally.How Has This Been Tested?
-
Screenshots (if appropriate):
Types of changes
Checklist:
py/visdom/VERSION
according to Semantic Versioning