Account created on 13 August 2021, almost 4 years ago
  • Engineer - Full Stack at QED42 
#

Merge Requests

More

Recent comments

🇮🇳India omkar-pd

Created CodeEditor404 component and CodeEditor‎Wrapper to render CodeEditor404 component on 404 error.

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

Or we could use useRef to fix the issue

diff --git a/ui/src/components/form/components/TextFieldAutocomplete.tsx b/ui/src/components/form/components/TextFieldAutocomplete.tsx
index 762e9b47..6ff8adee 100644
--- a/ui/src/components/form/components/TextFieldAutocomplete.tsx
+++ b/ui/src/components/form/components/TextFieldAutocomplete.tsx
@@ -1,6 +1,6 @@
 import clsx from 'clsx';
 import { TextField as RadixThemesTextField } from '@radix-ui/themes';
-import { forwardRef, useEffect, useImperativeHandle } from 'react';
+import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
 import type { MutableRefObject } from 'react';
 import type { Attributes } from '@/types/DrupalAttribute';
 import styles from './TextField.module.css';
@@ -40,6 +40,12 @@ const TextFieldAutocomplete = forwardRef(
     attributes['data-xb-no-update'] = '';
 
     const inputRef = ref as MutableRefObject<HTMLInputElement>;
+    const onChangeRef = useRef(attributes.onChange);
+
+    // Update ref when onChange changes
+    useEffect(() => {
+      onChangeRef.current = attributes.onChange;
+    }, [attributes.onChange]);
 
     // Create a version of the ref that will appease Typescript.
     useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);
@@ -55,7 +61,7 @@ const TextFieldAutocomplete = forwardRef(
       inputRef.current.removeAttribute('data-xb-no-update');
       setTimeout(() => {
         // Call the onChange listener so the Redux store is updated.
-        if (attributes?.onChange) {
+        if (onChangeRef.current) {
           const event = new Event('change');
 
           inputRef.current.value = e.detail.target.value;
@@ -63,8 +69,8 @@ const TextFieldAutocomplete = forwardRef(
             writable: false,
             value: inputRef.current,
           });
-          if (typeof attributes?.onChange === 'function') {
-            attributes.onChange(event);
+          if (typeof onChangeRef.current === 'function') {
+            onChangeRef.current(event);
           }
         }
       });
@@ -100,14 +106,14 @@ const TextFieldAutocomplete = forwardRef(
           // If the input is blurred, remove the attribute that prevents real
           // time preview updates.
           inputRef.current.removeAttribute('data-xb-no-update');
-          if (attributes?.onChange) {
+          if (onChangeRef.current) {
             const event = new Event('change');
             Object.defineProperty(event, 'target', {
               writable: false,
               value: inputRef.current,
             });
-            if (typeof attributes?.onChange === 'function') {
-              attributes.onChange(event);
+            if (typeof onChangeRef.current === 'function') {
+              onChangeRef.current(event);
             }
           }
         };
🇮🇳India omkar-pd

Adding attributes.onChange in dependency array fixes the issue.

While this causes the effect to run multiple times as onChange reference update, but I think it's necessary to ensure event handlers always have access to the current state.

🇮🇳India omkar-pd

omkar-pd changed the visibility of the branch 3514551-consider-enabling-claro to active.

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

If we click "remove from components" we get The 'imported_js_components' field is required when 'source_code_js' or 'compiled_js' is provided

and if we click on delete we get 403 forbidden with error There is other configuration depending on this code component.

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

It looks like the "Create new revision" checkbox value (revision = true) isn't returned in the entity_form_fields data because of the way we filter form values here:

return Query::parse(http_build_query(array_intersect_key($values, $entity->toArray())));

However, revision is not part of $entity->toArray(), so it gets stripped out by array_intersect_key(), even though it exists in $values

🇮🇳India omkar-pd

Tested this and it's working as expected. 🎉

🇮🇳India omkar-pd

Yes, @hooroomoo, I'm using chrome.

Let me test this in Firefox.

🇮🇳India omkar-pd

Currently, it scrolls while dragging in the layers menu.

🇮🇳India omkar-pd

Code Looks good. But need approval from code owner. so keeping this in Needs Review.

🇮🇳India omkar-pd

+1 #13 🐛 The context menu is not accessible for JS components from library Active

I tried debugging this a couple of days ago and came to the same conclusion. I attempted to reattach the event listeners, but it didn’t work. I also tried replacing the cloned element with the original one, but the item in the event is different from the original element—it is the rendered output of that component.

🇮🇳India omkar-pd

Also, the preview is not working for existing components (eg- Heading, Hero) once dragged to Canvas.

🇮🇳India omkar-pd

This will not solve the issue for slots (one col, two col). Changes should be made in SlotOverlay.tsx to also solve that issue.

🇮🇳India omkar-pd

I have rebased with the latest changes. All tests are passing except for one, which remains unaffected by the code changes.img[src*="/experience_builder/components/image/600x400.png"]' was found in iframe '[data-xb-preview="lg"][data-test-xb-content-initialized="true"][data-xb-swap-active="true"]': expected **false** to equal **true**

🇮🇳India omkar-pd

I think the work on default_markup for code components is still pending.

default_markup: "@todo Make something 🆒 in https://www.drupal.org/project/experience_builder/issues/3498889" - Which appears to be fixed issue.

🇮🇳India omkar-pd

The component preview is now loading, but it appears empty. Debugging the issue.

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

Raised PR with Proposed resolution.

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

I've implemented the changes as mentioned in #5. Keeping this in "Needs Review" since tests are still required, allowing someone else to pick it up and continue

🇮🇳India omkar-pd

In AutoSaveManager.php there is a @todo Update label from incoming entity data once it exists for label.
https://git.drupalcode.org/project/experience_builder/-/blob/0.x/src/Aut...

Is it the right change?

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

🇮🇳India omkar-pd

Thank you for the fix @atul_ghate and @a.dmitriiev

🇮🇳India omkar-pd

omkar-pd made their first commit to this issue’s fork.

Production build 0.71.5 2024