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

confusing map view, putJson appears with no apparent reason #6486

Open
ekeren opened this issue May 15, 2024 · 4 comments
Open

confusing map view, putJson appears with no apparent reason #6486

ekeren opened this issue May 15, 2024 · 4 comments
Labels
🐛 bug Something isn't working 🛫 console Console needs-discussion Further discussion is needed prior to impl

Comments

@ekeren
Copy link
Collaborator

ekeren commented May 15, 2024

I tried this:

bring cloud;

let b = new cloud.Bucket();
let sqs = new cloud.Queue();
b.onCreate(inflight (f) => {
  sqs.push(f);
});

sqs.setConsumer(inflight (m) => {
  log("{m}");
});

let fn = new cloud.Function(inflight () => {
  b.put("file.txt", "Hello World");
});

This happened:

image

I expected this:

  1. Not to see putJson
  2. The oncreate handler should have a connection to the queue (via push) - (probably already covered by missing UI connection from Api to Bucket #6458)

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.73.46

Node.js Version

No response

Platform(s)

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@ekeren ekeren added 🐛 bug Something isn't working 🛫 console Console labels May 15, 2024
@Chriscbr
Copy link
Contributor

The oncreate handler should have a connection to the queue (via push) - (probably already covered by #6458)

I believe this will be fixed by #6509

Not to see putJson

I want to say this could be expected behavior, but I'm curious to learn what you'd like to see as a user.

Take this example:

bring cloud;

let b = new cloud.Bucket();
let q = new cloud.Queue();
q.setConsumer(inflight () => {
  b.put("file.txt", "Hello World");
});

I never call the queue's "push" method in the app code. But the Wing Console shows "push()" in the map.

Screenshot 2024-05-17 at 12 00 49 AM

@ekeren I'm curious does this feel like the same problem to you? Or do you think the problem showing put() and putJson() is different?

(BTW, we could hide the inner function if needed so that it instead looks like the map below)
Screenshot 2024-05-17 at 12 14 10 AM

@ekeren
Copy link
Collaborator Author

ekeren commented May 17, 2024

I don't understand why push is there, it is very confusing

I would expect to see a:

⚡️ consumer
Handler and no push

@Chriscbr Chriscbr added the needs-discussion Further discussion is needed prior to impl label May 17, 2024
@Chriscbr
Copy link
Contributor

@ekeren I'm not sure I understand but maybe a synchronous discussion will help. 😄

BTW, I want to share one more example where I created my own Queue class:

bring cloud;

class Queue {
  b: cloud.Bucket;
  new() {
    this.b = new cloud.Bucket();
    nodeof(this.b).hidden = true;
  }
  pub inflight push(msg: str) {
    this.b.put("file.txt", msg);
  }
  pub inflight pop() {
    this.b.delete("file.txt");
  }
  pub inflight boring() {
    log("this method does not interact with other resources");
  }
  pub setConsumer(fn: inflight (str): void) {
    this.b.onUpdate(fn);
  }
}

let b = new cloud.Bucket();
let q = new Queue();
q.setConsumer(inflight () => {
  b.list();
});

The Queue class has three inflight methods, push, pop, and boring. boring does not interact with any other resources.

Even though I do not have a cloud.Function that is calling the push or pop methods on my class, to me it feels intuitive that the visual map shows the methods of the class I wrote.

Screenshot 2024-05-17 at 2 13 21 PM

To me what may be confusing is not all of my class's methods are shown - the Wing Console doesn't show there is a boring method that can also be called.

@skyrpex
Copy link
Contributor

skyrpex commented May 29, 2024

I'd prefer to have the public API of every class, too. The private methods, not that important IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛫 console Console needs-discussion Further discussion is needed prior to impl
Projects
Status: 🆕 New - not properly defined
Development

No branches or pull requests

3 participants