-
-
Notifications
You must be signed in to change notification settings - Fork 526
Fixed #1267 add ability to import from JsonLogic #1271
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
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e15d1e3:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1271 +/- ##
=======================================
Coverage 79.73% 79.73%
=======================================
Files 246 246
Lines 13104 13104
Branches 1728 1728
=======================================
Hits 10448 10448
Misses 1792 1792
Partials 864 864 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I've removed changes to a lock file from your branch to fix issues with CI (pnpm lock file should have version 6) |
Done and fix the issues
…On Mon, Jun 2, 2025 at 9:39 AM Denys Oblohin ***@***.***> wrote:
*ukrbublik* left a comment (ukrbublik/react-awesome-query-builder#1271)
<#1271 (comment)>
I've removed changes to a lock file from your branch to fix issues with CI
(pnpm lock file should have version 6)
Please run pnpm lint-fix to fix lint errors.
—
Reply to this email directly, view it on GitHub
<#1271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6SAR6TMUKT33ZKFKJPTZRD3BQEUHAVCNFSM6AAAAAB6L5DZDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMRZGQ2TQMBZGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
// Parse the JSON string | ||
const jsonLogicObj = JSON.parse(jsonLogicStr); | ||
|
||
// Import using Utils.loadFromJsonLogic (or Utils.Import._loadFromJsonLogic if that's the correct path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
const [tree, logicErrors] = Utils.Import._loadFromJsonLogic(jsonLogicObj, state.config)
and render logicErrors
(it's list of errors)
</button> | ||
</div> | ||
|
||
{jsonLogicErrors.length > 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to top of modal
const jsonLogicObj: unknown = JSON.parse(jsonLogicStr); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
const tree = Utils.loadFromJsonLogic(jsonLogicObj as JsonLogicFunction, state.config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct type is JsonLogicTree
_loadFromJsonLogic(logicTree: JsonLogicTree | undefined, config: Config): [ImmutableTree | undefined, Array<string>]; |
const tree = Utils.loadFromJsonLogic(jsonLogicObj as JsonLogicFunction, state.config); | |
const [tree, logicErrors] = Utils._loadFromJsonLogic(jsonLogicObj as JsonLogicTree, state.config); | |
if (logicErrors?.length) { | |
throw logicErrors; // TODO: use in `setJsonLogicErrors` | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
Thanks for pointing that out — I had a look at PR #1271 and saw that the core logic for importing from JsonLogic is already in place. My proposal is to build on top of that by adding a simple JSON editor (e.g. modal with monaco or react-json-view) so users can paste their JsonLogic directly into the UI and trigger the import without touching the code. This would make the feature more accessible for non-dev users and better for testing. I’d be happy to keep the UI clean and follow the structure used in the existing implementation. Let me know if you’re open to that direction. I am available to start working on the project now |
“Hi @ukrbublik I contributed this PR via OnlyDust and was wondering if it might be eligible for reward. Let me know if there's anything I should improve or focus on in future contributions!” |
What kind of reward? With next contributions please create new branch for your changes instead of pushing to master. |
No description provided.