-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(AstBuilder): add save method #90
feat(AstBuilder): add save method #90
Conversation
@@ -1,12 +1,12 @@ | |||
import { type NodeDto } from '@marble-api'; | |||
import * as R from 'remeda'; | |||
|
|||
export interface AstNode { | |||
export type AstNode = { |
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.
This is required in order to be compatible with JSON type.
In short, interface do not have index type, and raise issue when passed as a JSON value.
(more info here)
@@ -146,7 +144,7 @@ export default function RuleEdit() { | |||
identifiers, | |||
operators, | |||
onSave: (astNodeToSave: AstNode) => { | |||
fetcher.submit(JSON.stringify(astNodeToSave), { | |||
fetcher.submit(astNodeToSave, { |
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.
This is where we need to have a type compatible with JSON type declaration.
<Button | ||
type="submit" | ||
className="w-fit" | ||
onClick={() => { | ||
astEditor.save(); | ||
}} | ||
> |
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.
We no longer use Form
component
ad9453e
to
dda24da
Compare
Small changes to add the possibility to save changes.