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
.get is confusing #39
Comments
Couple of ideas:
2a. Rename
2b. Rename get to something less verby like "reference", "ref", "for"
I'm actually in favor of combining a few options. As long as one option isn't any more performant than another so we have to tell folks "well, you should do A instead of B, even though we let you do B". Thinking through what I expect folks to do, I'd expect them to mostly use 4 simply because a lot of folks have start up code which is like "createIfNotExists" for db and container, so they'll already have async operations we can return a reference object from. I think 2b is a good solution to avoiding I still like the idea of doing 3, but its less necessary, so we can weigh the risk or do it in a separate PR. I think 1 pairs nicely with 4, but 2b + 4 would be enough to test the idea, so 1 could also be post-poned. |
I think 4 and my Symbol proposal are compatible. We can store the header data on the reference object. Or return an intersection type ( |
3 could be done without proxies by moving to singular methods for reference objects: Proxy: In the latter case, what if we dropped |
Yeah, I think we can make 4 compatible, but it does increase complexity slightly, so I figured I'd call that out as a con. I think your suggestion on how to do 3 without proxies is just 2a with a change to move/duplicate the singular accessor to the parent object type? Let's just call this 5 instead of 2a` Comparing 2a and 5:
const {result: items} = await client.databases.database(id).containers.container(id).items.readAll();
const {result: item} = await client.databases.database(id).containers.container(id).items.item(id).read();
const {result: items} = await client.database(id).container(id).items.readAll();
const {result: item} = await client.database(id).container(id).item(id).read(); And you'd just drop
You could still do 4 & 5 together. You could still do 1 & 5 together, but it's less of an improvement than with 2a/2b + 1. Overall, I think I like it. While I think the Proxies version would be better overall, I think this is likely more intuitive for the current state of JavaScript. Maybe in v3, we could move to proxies without any concerns on user experience. |
Held a meeting to discuss. Notes: 4 & 5 make sense to do. Chris is gonna pick up 4 and Steve is gonna pick up 5. We'll prioritize getting database, container, and item done by tomorrow morning so Deborah can update the sample for Thursday user study. Actions:
|
This has now been addressed in the 2.0.0-3 release. |
We've gotten some feedback from user studies that .get is confusing.
Let's track in this issue our ideas
The text was updated successfully, but these errors were encountered: