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

Dashboard: Log warning instead of an error when trigger is not found #2144

Merged
merged 2 commits into from
Mar 19, 2020

Conversation

arturi
Copy link
Contributor

@arturi arturi commented Mar 18, 2020

From a support ticket:

How to get rid of this JS error:
Dashboard modal trigger not found. Make sure trigger is set in Dashboard options unless you are planning to call openModal() method yourself

Of course it should have been a warning all along, but maybe we shouldn’t display it at all, ie when trigger not specified = you intend to call openModal yourself? More noise vs confusion when someone can’t figure out why the Dashboard modal won’t appear 🤔

@arturi arturi requested a review from goto-bus-stop March 18, 2020 11:50
@goto-bus-stop
Copy link
Contributor

Turned into an error here: #1217

I think the idea for this was to log the error if you did specify a trigger with a CSS selector, but no elements matched it. But the condition doesn't actually check that a trigger selector was set.

@arturi
Copy link
Contributor Author

arturi commented Mar 18, 2020

Right! 🙏 That thought also crossed my mind. Will update the condition instead.

@arturi
Copy link
Contributor Author

arturi commented Mar 18, 2020

Trouble is, we have trigger: '#uppy-select-files' as the default :(

Will update the condition and leave the default be, but change to null in 2.0?

@goto-bus-stop
Copy link
Contributor

goto-bus-stop commented Mar 18, 2020

🤯 that's very silly! At least, now that we have these modal APIs and react components, it is 😛

Maybe we should do that in 2.0 then and do this for now

@arturi
Copy link
Contributor Author

arturi commented Mar 18, 2020

Well yeah, I think my reasoning was to allow .use(Dashboard) without any config at all — it just picks up a button/input with the correct id on the page by default. I think I’ve seen it done like this somewhere — less boilerplate for the user, but yeah, probably more confusing in the long run.

@goto-bus-stop
Copy link
Contributor

yes, sorry, it likely made sense at an earlier stage. Now that we have all these different ways of using the Dashboard it becomes a bit complicated 😅

@arturi arturi merged commit 7021657 into master Mar 19, 2020
@delete-merged-branch delete-merged-branch bot deleted the dashboard-modal-trigger-warn branch March 19, 2020 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants