Skip to content
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

Fix drag issue when contains same field #364

Merged
merged 2 commits into from
Apr 8, 2024
Merged

Conversation

islxyqwe
Copy link
Member

@islxyqwe islxyqwe commented Apr 8, 2024

fixed a drag issue when dragging same field into same channel, there will be drag issue with theme because of same dragId.

Copy link

vercel bot commented Apr 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
graphic-walker ✅ Ready (Inspect) Visit Preview Apr 8, 2024 6:53am

Copy link
Contributor

github-actions bot commented Apr 8, 2024

Risk Level 2 - /home/runner/work/graphic-walker/graphic-walker/packages/graphic-walker/src/fields/obComponents/obFContainer.tsx

The code seems to be well written and follows the SOLID principles. However, there is a potential risk of performance degradation due to the use of map function. Consider using a more efficient data structure or algorithm if the size of allEncodings[dkey.id] is large.

Example:

// Use a more efficient algorithm if the size of allEncodings[dkey.id] is large
allEncodings[dkey.id].map((f, index) => (
    ...
))

Risk Level 2 - /home/runner/work/graphic-walker/graphic-walker/packages/graphic-walker/src/fields/encodeFields/singleEncodeEditor.tsx

The code seems to be well written and follows the SOLID principles. However, there is a potential risk of performance degradation due to the use of map function inside useMemo hook. Consider using a more efficient data structure or algorithm if the size of GLOBAL_CONFIG.AGGREGATOR_LIST and allFields is large.

Example:

const aggregationOptions = useMemo(() => {
    // Use a more efficient algorithm if the size of GLOBAL_CONFIG.AGGREGATOR_LIST is large
}, []);

const foldOptions = useMemo<ISelectContextOption[]>(() => {
    // Use a more efficient algorithm if the size of allFields is large
}, [allFields]);

Risk Level 2 - /home/runner/work/graphic-walker/graphic-walker/packages/graphic-walker/src/lib/op/aggregate.ts

The code seems to be well written and follows the SOLID principles. However, there is a potential issue with the error handling. When the expr function is called, if the result is an array, an error is thrown. This error message is not very descriptive and could be improved to provide more context about the error. Also, the error handling could be improved by using a try-catch block to handle any potential errors that could occur when calling the expr function.

try {
    const result = expr(mea.field, subGroup);
    if (result instanceof Array) {
        throw new Error(`Expected aggregated result, but got array. Calculation: ${mea.field}`);
    }
    aggRow[aggMeaKey] = result;
} catch (error) {
    console.error(`Error calculating ${mea.field}: ${error}`);
}

This will provide more context about the error and handle it gracefully.


📝🐌💥


Powered by Code Review GPT

@ObservedObserver ObservedObserver merged commit 214dbaf into main Apr 8, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants