tiagobento opened a new issue, #3746:
URL: https://github.com/apache/incubator-kie-tools/issues/3746

   
https://github.com/kiegroup/kie-issues/assets/8044780/455af587-07a5-4ba0-ad18-664bf9c34ef4
   
   The issue can be spotted for 'Context' and 'Invocation' that are freshly 
created (or their entries have been reset) and their entries are 'Undefined'.
   
   The issue is difficult to fix completely, i.e. for a scenario when user 
change the width, then close and reopen the expression. Reopening is a problem, 
because in model structure, we do not have a field, where we could store the 
width, see:
   ![Screenshot 2023-06-23 
085345](https://github.com/kiegroup/kie-issues/assets/8044780/648665a0-8963-4eb1-9737-064183de7dd1)
   
   We store just width of first column (entry info), but the width of second 
column (entry expression) we compute from the nested expression itself, what is 
a problem, when nested expression is not defined.
   
   Taking ^ into account, still it should be possible to fix a scenario, when 
user is changing width of similar context expression and do not reopen the 
expression.
   
   however there is a problem with this codebase `Hooks.tsx`:
   ![Screenshot 2023-06-23 
084911](https://github.com/kiegroup/kie-issues/assets/8044780/e47d4dc4-dc95-4fbf-94f9-c0c494a9d43d)
   
   - `nestedExpressionContainerResizingWidthValue` has value `-2`, what is some 
default value. This I see as problem, because it is for sure wrong information. 
`nonNestedExpressions` is a variable that I added for debugging and for 
showing, there is a number, that we can use for computing the real width, just 
not sure how to do it properly, because for now, I do not understand our 
`BeeTable` framework so much
   - on line 50, `...nestedExpressions.map((e) => getExpressionResizingWidth(e, 
new Map())),` , I am not sure why e pass empty map of resizing widths, It kind 
of suggest, `getExpressionResizingWidth` needs always return some default 
value, instead of the actual.
   - with this code change [1], notice 
`nestedExpressionContainerResizingWidthValue`, I was able to get 
`boxed-expression-component` improvement [2] but not working in `online-editor` 
   
   [1]
   ```js
   export function useNestedExpressionResizingWidthValue(
     isPivoting: boolean,
     nestedExpressions: ExpressionDefinition[],
     fixedColumnActualWidth: number,
     fixedColumnResizingWidth: ResizingWidth,
     fixedColumnMinWidth: number,
     nestedExpressionMinWidth: number,
     extraWidth: number
   ) {
     const { resizingWidths } = useResizingWidths();
     const nestedExpressionContainer = useNestedExpressionContainer();
     const pivotAwareNestedExpressionContainer = 
usePivotAwareNestedExpressionContainer(isPivoting);
   
     const nestedExpressionResizingWidthValue = useMemo<number>(() => {
       if (nestedExpressionContainer.resizingWidth.isPivoting && !isPivoting) {
         return nestedExpressionContainer.resizingWidth.value - 
fixedColumnResizingWidth.value - extraWidth;
       }
       const nestedPivotingExpression: ExpressionDefinition | undefined = 
nestedExpressions.filter(
         ({ id }) => resizingWidths.get(id)?.isPivoting ?? false
       )[0];
   
       if (nestedPivotingExpression) {
         return Math.max(getExpressionResizingWidth(nestedPivotingExpression, 
resizingWidths), fixedColumnMinWidth);
       }
   
       const nonNestedExpressions = 
Array.from(resizingWidths.keys()).filter(rwKey => 
!nestedExpressions.some(({id}) => rwKey === id));
       if (nonNestedExpressions.length === 1) {
         console.debug(resizingWidths.get(nonNestedExpressions[0])?.value + " 
debug");
       }
        
       const nestedExpressionContainerResizingWidthValue =
         fixedColumnResizingWidth.value >= fixedColumnActualWidth
           ? (nonNestedExpressions.length === 1 ? 
resizingWidths.get(nonNestedExpressions[0])?.value ?? nestedExpressionMinWidth  
: pivotAwareNestedExpressionContainer.resizingWidth.value)
           : nestedExpressionContainer.actualWidth;
   
       return Math.max(
         nestedExpressionContainerResizingWidthValue - 
fixedColumnResizingWidth.value - extraWidth,
         ...nestedExpressions.map((e) => getExpressionResizingWidth(e, new 
Map())),
         nestedExpressionMinWidth
       );
     }, [
       nestedExpressionContainer.resizingWidth.isPivoting,
       nestedExpressionContainer.resizingWidth.value,
       nestedExpressionContainer.actualWidth,
       isPivoting,
       nestedExpressions,
       fixedColumnResizingWidth.value,
       fixedColumnActualWidth,
       pivotAwareNestedExpressionContainer.resizingWidth.value,
       extraWidth,
       nestedExpressionMinWidth,
       resizingWidths,
       fixedColumnMinWidth,
     ]);
   
     return nestedExpressionResizingWidthValue;
   }
   ```
   
   [2]
   
   
https://github.com/kiegroup/kie-issues/assets/8044780/b579c106-0af0-4383-8f30-3edd41244c15
   
   
   
   ```[tasklist]
   ### Acceptance criteria
   - [ ] Write a nice description for this issue.
   - [ ] Add acceptance criteria here.
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to