dididy commented on PR #5044:
URL: https://github.com/apache/zeppelin/pull/5044#issuecomment-3228343521

   > Nice fix! Since the `setTimeout(..., 200)` is a heuristic to dodge a race, 
could we add a short comment explaining (1) why it's needed and (2) a TODO o 
how to make this deterministic or order-independent?
   
   
https://github.com/apache/zeppelin/pull/5044/commits/ab073599e086c6f9fb9084122814c0b0778d970d
   
   Ensuring the execution order of EDITOR_SETTING seems necessary because it 
can otherwise cause a bug that passes through the short-circuit condition. 
Although this issue does not reproduce for everyone, controlling the execution 
timing appears to be required.
   
   <img width="663" height="749" alt="image" 
src="https://github.com/user-attachments/assets/430a5a24-19dc-4e6b-89c1-b5ede2515c85";
 />
   
   EDITOR_SETTING is executed when the first paragraph component is rendered. 
From the Classic UI console logs above, we can see that it runs after 
INTERPRETER_BINDINGS. Therefore, I added a variable editorSettingTriggerAllowed 
with an initial value of false in 
/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts. 
The getEditorSetting method now only executes if this variable is true.
   
   Then, in app/pages/workspace/notebook/notebook.component.ts, I added code 
that sets editorSettingTriggerAllowed to true for all paragraphs and calls 
getEditorSetting when receiving INTERPRETER_BINDINGS.
   
   The part where I noticed the issue was at the moment of PARAGRAPH_ADDED. 
When a new paragraph component is added, getEditorSetting is immediately 
executed. This triggers EDITOR_SETTING, but since execution is now blocked by 
editorSettingTriggerAllowed, as I fixed, it does not run at that point. 
Instead, editorSettingTriggerAllowed is set to true and getEditorSetting is 
executed when the PARAGRAPH message is received.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to