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

feat(AstBuilder): add save method #90

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

balzdur
Copy link
Collaborator

@balzdur balzdur commented Aug 30, 2023

Small changes to add the possibility to save changes.

@@ -1,12 +1,12 @@
import { type NodeDto } from '@marble-api';
import * as R from 'remeda';

export interface AstNode {
export type AstNode = {
Copy link
Collaborator Author

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, {
Copy link
Collaborator Author

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.

Comment on lines +184 to +190
<Button
type="submit"
className="w-fit"
onClick={() => {
astEditor.save();
}}
>
Copy link
Collaborator Author

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

@balzdur balzdur requested a review from a team August 31, 2023 14:14
@Vivien-marble Vivien-marble merged commit c431882 into feature/refactor-builder Aug 31, 2023
1 check passed
@Vivien-marble Vivien-marble deleted the thomas/refactor-builder branch August 31, 2023 15:10
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.

3 participants