question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC for fetchBy* queries

See original GitHub issue

Describe the feature you’d like:

To get an element from the dom, we have 6 variants viz. getBy, getAllBy, queryBy, queryAllBy, findBy, and findAllBy.

More often than I like to admit I would visit cheatsheet to find the method I’m looking for.

Suggested implementation:

A sample usage for react(can be adopted for rest)

fetchByText(/text/, { allowEmpty: true, allowMultiple: false });

This would be able to combine get* and query* queries. We would still need to consider find* because of thats the only async query.

Proposal for findBy* is

asyncFetchByText(/text/, { allowMultiple: false });
fetchByTextAsync(/text/, { allowMultiple: false });

Describe alternatives you’ve considered:

Visit cheatsheet when you forget what does what

Teachability, Documentation, Adoption, Migration Strategy:

We should be able to include this along with the rest of the variants.

Would be happy to implement it myself  😀

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
smeijercommented, Sep 22, 2020

I’m comfortable with the way that it currently is. If there is a real need, I’m available to help shaping a nice and simplified api for a wrapper lib.

I’m not in favor of adding the change directly to the core, as it would be a HUGE breaking change, if the existing methods are being removed. If the existing methods would be kept to ease migration, the change would only add more methods, making things more confusing.

5reactions
kentcdoddscommented, Sep 22, 2020

A big problem for this would be TypeScript. If the result could be null or undefined then you have to cast the value every time which would be annoying.

I’m sorry, but it’s extremely unlikely that we’re going to change the name of these methods now. The name of methods is entirely a familiarity thing. It’s subjective, so making an API change will cause more confusion than benefit.

I’m willing to be swayed by other maintainers, but right now I’m pretty positive this will not happen. A wrapper library could be created though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple Nomenclator Query Protocol (SNQP) RFC 2259
This memo provides information for the Internet community. · The Simple Nomenclator Query Protocol (SNQP) allows a client to communicate with a descriptive...
Read more >
RFC 7072: A Reputation Query Protocol
Introduction This document defines a method to query a reputation data service for information about an entity, using the HyperText Transfer Protocol (HTTP) ......
Read more >
1598078 – Unbound-anchor RFC 5011 root keys update ...
It can delay new key fetch by local DNS server cache. It will reduce load of root servers. It will work on intranets...
Read more >
RFC: Method for avoiding unions for faster queries...
In the quest for efficiency on partition table queries, I made a discovery which might be worth replicating and expanding into a partition ......
Read more >
Databases and the Doctrine ORM
Updating an Object; Deleting an Object; Querying for Objects: The Repository ... See RFC 3986 for the full list of reserved characters or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found