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

[v2]"Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 #311

Closed
erwanito12 opened this issue Jul 24, 2023 · 2 comments
Labels
bug Something isn't working v2 Related to Baklava v2
Projects

Comments

@erwanito12
Copy link

I've made a simple example of the logic I'd like to use.
I'd like to make an output display Component that can both display a view in which you can perform operations on values and display them via canvas, for example, and a port to transmit these modified values to subsequent nodes. This was possible with version 1 of baklavaJS.
The problem is that as soon as I setPort(true) the Component display view disappears.

export default defineNode({ type: "OutputNode2", inputs: { myCompIn: () => new MyComponentInterface("myComp", 10).setPort(true), text: () => new NodeInterface("Text", "").use(setType, stringType), boolean: () => new CheckboxInterface("Boolean", false).use(setType, booleanType), }, outputs: { myCompOut: () => new MyComponentInterface("myComp", 0).setPort(false), // myComp: () => new NodeInterface("myComp", 0).setPort(true), }, calculate(inputs: any) { console.log(inputs.myCompIn) return {myCompOut: inputs.myCompIn }; }, });

export default defineNode({ type: "OutputNode3", inputs: { // myCompIn: () => new MyComponentInterface("myComp", 10).setPort(true), text: () => new NodeInterface("Text", "").use(setType, stringType), boolean: () => new CheckboxInterface("Boolean", false).use(setType, booleanType), }, outputs: { myCompOut: () => new MyComponentInterface("myComp", 0).setPort(true), // myComp: () => new NodeInterface("myComp", 0).setPort(true), }, calculate(inputs) { console.log(inputs) return {myCompOut: inputs.text}; }, });
image

@erwanito12 erwanito12 changed the title "Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 "Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 label:v2 Jul 24, 2023
@erwanito12 erwanito12 changed the title "Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 label:v2 "Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 Jul 24, 2023
@erwanito12 erwanito12 changed the title "Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 [v2]"Integration of setPort(true) Causes Disappearance of Display Component View in BaklavaJS v2 Jul 24, 2023
@newcat newcat added bug Something isn't working v2 Related to Baklava v2 labels Jul 24, 2023
@newcat newcat added this to Done but not released in V2 Jul 24, 2023
@newcat
Copy link
Owner

newcat commented Jul 24, 2023

Fixed in v2.0.2-beta.5

@newcat newcat closed this as completed Jul 24, 2023
@newcat newcat moved this from Done but not released to Done in V2 Jul 24, 2023
@erwanito12
Copy link
Author

I have another problem, I used the example in the documentation. When the display component is in input, it's reactive: the value of modelValue increments when I click, but not in output. How can I make it reactive and send the new value to the output?
`
<button @click="add" >{{ modelValue }}

<script> import { defineComponent } from "vue"; export default defineComponent({ props: { modelValue: { type: Number, // readonly: false, required: true, }, }, emits: ["update:modelValue"], setup(props, { emit }) { const add = () => { console.log('modelValue', props.modelValue); console.log('modelValue', props); emit("update:modelValue", props.modelValue + 1); console.log('modelValue+1', props.modelValue); }; return { add }; }, }); </script>`

`import { markRaw } from "vue";
import { NodeInterface, setType } from "baklavajs";
import MyComponent from "./MyComponent.vue";
import { numberType } from "@/interfaceTypes";

export class MyComponentInterface extends NodeInterface {
type: any;
constructor(name: string, value: any) {
super(name, value);
this.setComponent(markRaw(MyComponent));
// this is just an example, the interface types plugin works a bit different
this.use(setType, numberType);
}
}

const i = new MyComponentInterface("My Interface",0);
console.log(i.value); // Affiche : 0
console.log(i.component === MyComponent); // Affiche : true
console.log(i.type); // Affiche : "number"`
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2 Related to Baklava v2
Projects
Status: Done
V2
  
Done
Development

No branches or pull requests

2 participants