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.

DEFAULT_SELECT in Carto::User

See original GitHub issue

Follow up from: https://github.com/CartoDB/cartodb/pull/9274/files/d2f647894deaf6a13188269d506a8f8bfbc22abc#r73366547

There, I proposed getting rid of DEFAULT_SELECT in Carto::User, as it is only used when following two associations: vis->user (DEFAULT_SELECT) and permission->user (SELECT_WITH_DATABASE). It makes reasoning about the code harder, because the model will have different fields loaded depending on where it comes from.

It is also the likely culprit of this issue: https://rollbar.com/vizzuality/CartoDB/items/19657/occurrences/14987729788/ You can see in the JSON for person that the fields included there match the fields in DEFAULT_SELECT. It should not happen though, because in that branch of the code, the user is extracted following layer->map->user, which should load the full user model. I don’t know why it sometimes, it only loads the default fields. AR caching maybe? I haven’t been able to consistently reproduce, it seems random.

This was originally introduced for security/performance. IMHO, performance should not be a problem (the DB has to load the entire disk page anyway) and security (regarding exposing private information) should not be handled here (it is the job of the controller/presenter). It only affected some associations anyway, so I feel the point is moot.

I think we should remove it as I don’t feel it is adding much, but makes the code harder to read and may be causing some issues.

cc @juanignaciosl @gfiorav

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
juanignacioslcommented, Aug 4, 2016

I don’t agree on a). It’s a not big optimization that makes reasoning with code harder, so the tradeoff might pay at the most important associations but not at others. b) is true but we can’t remove many columns. There’s a lot of them that are only used in specific scenarios (that’s why we can select a projection for most of them), but only a couple are actually deprecated.

Removing columns is not a short term goal. I’d…

  1. Check whether that error can be fixed by adding some columns to the select or just removing it.
  2. Do whatever 1 output fits better (add columns / remove DEFAULT_SELECT).
  3. Roadmap removing columns.
0reactions
juanignacioslcommented, Feb 14, 2017

Closing automatically because of inactivity. If anybody considers that this still important, please reopen and it’ll be prioritized.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set the default value for an HTML <select> element
The default value of the select element can be set by using the 'selected' attribute on the required option. This is a boolean...
Read more >
Feature Selection tool - CARTO Documentation
Feature Selection tool The Feature Selection tool allows you to apply a mask to the map, filtering out the features that lie outside...
Read more >
How can I set the default value for an HTML <select> element?
I just posted an answer that enables to dynamically change the defaults, it also covers the multiple selection. And it works in Reactjs....
Read more >
How to set the default value for an HTML ... - Educative.io
You can choose your default value by setting your default value of choice to selected , as shown below.
Read more >
<select>: The HTML Select element - HTML - MDN Web Docs
You can include a selected attribute on an <option> element to make it selected by default when the page first loads. The <select>...
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