RFC: Parsing hook names should display better error messages
jstejada opened this issue · comments
Proposal
When attempting to extract hook names for an inspected element, if source maps aren't available or they fail to load for some reason, the UI doesn't show any indication of that happening, and instead silently "succeeds", but without showing any actual hook names.
When this happens, we should probably handle it differently:
- If we can detect that the source code wasn't actually transformed at build time, continue attempting to extract hook names from the original source code.
- If we can detect that the source code /was/ transformed at build time, but we don't have source maps available, show an error to the user
When attempting to extract hook names for an inspected element, if source maps aren't available or they fail to load for some reason, the UI doesn't show any indication of that happening, and instead silently "succeeds", but without showing any actual hook names.
My understanding of what happens/should happen (although maybe we are missing some edge cases) is this:
-
If a source file or source map fails to load, the Suspense cache should resolve a
RejectedRecord
and returnnull
- which should cause an error tooltip to be displayed:
-
If source and source maps load and we parse them and still can't infer names for hooks, for some reason, the cache will return an array of
null
entries, which will look like this:
This second case might be confusing.
If we can detect that the source code wasn't actually transformed at build time, continue attempting to extract hook names from the original source code.
We should already be doing this. We have a lot of tests that verify this (// original source (uncompiled)
)
If we can detect that the source code /was/ transformed at build time, but we don't have source maps available, show an error to the user
This would be an improvement over the generic error we're currently showing. I've thought a little about how we might handle this. Maybe return a string (error message) rather than null
for the RejectedRecord
case?
Hi, I am a young FS developer. I would like to work on this issue.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!