-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: use placeholders for data connectors #3483
Conversation
You can access the deployment of this PR at https://renku-ci-ui-3483.dev.renku.ch |
0904902
to
f1a36eb
Compare
placeholder={option.convertedDefault?.toString() ?? ""} | ||
placeholder={ | ||
option.convertedDefault && | ||
option.convertedDefault?.toString() !== "[object Object]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no type information to prevent this? This would also display unusable information when typeof option.convertedDefault === "function"
or when typeof option.convertedDefault === "symbol"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a good rule to generalize.
There are convoluted objects as defaults, but never functions nor symbols
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use typeof
then? It would be more robust than checking string representation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that simple. convertedDefault
already has a stringy version of the object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about merging this quick fix so we can include it in the release and then find a more sophisticated fix later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but I'm not gonna appreciate it if this is not fixed asap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data quality we get from the storage_schema
endpoint isn't great, and that's coming straight from Rclone
(I guess multiple contributions from different people ended up in various attributes/formats for default values).
Harmonizing them all isn't worth the effort since we use them as placeholders, so a function deals with the most common defaults and converts them to numbers/booleans/strings.
Improving the situation here would require dealing with this issue in the first place. If you feel that's important, you are welcome to improve the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very different from understanding that comparing to [Object object]
is not robust, because many objects have a different representation. The issue is that the convertedDefault
variable is not robust and the code which creates it needs to be updated unless we want to deal with more bugs in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand very well the difference between testing myObject.toString() === "[object Object]"
and typeof myObject === "object"
. And I understand the solution for convertedDefault
isn't the best.
But I do not understand the request to convert a quick bugfix PR into overhauling the logic to handle non-standard values for cases that never appear.
Again, feel free to improve the logic whenever you have time. That's always welcome for every part of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because replacing buggy code with another buggy code is not going to be sustainable. Doing === "[object Object]"
is a big code smell which indicates that there is a problem with the code and that should not happen. At the very least it should be tracked and solved quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! The change makes sense, the default values now work as expected, and I've reviewed and tested the connection for both personal and shared Polybox, and it's still working well.
Tearing down the temporary RenkuLab deplyoment for this PR. |
This PR reverts the data connector option default values to the previous behavior.
It also prevents showing objects converted to strings as placeholders.
/deploy