sentry-docs icon indicating copy to clipboard operation
sentry-docs copied to clipboard

surprising behavior of `supported`/`notSupported` when platform has fallback

Open lobsterkatie opened this issue 3 years ago • 2 comments

Steps to Reproduce

  1. Add an option to the main config/options page
  2. Set the supported flag to ['javascript']
  3. Build the docs
  4. Go to the RN version of the options page

Expected Result

To not see the option, since RN isn't in the list of supported platforms.

Actual Result

I do see the option.

Additional Info

The reason this is happening is the logic used to decide whether or not to show a PlatformSection element (ConfigKey is just a wrapper around PlatformSection).

https://github.com/getsentry/sentry-docs/blob/ccb0eaa8bc7070b25916c568475b9a487e07de9e/src/components/platformSection.tsx#L29-L53

The isSupported() function correctly says that RN doesn't support the option. But because of getPlatformsWithFallback(), javascript is also checked, and because it does have the option, that option ends up showing up on the RN page.

There are lots of circumstances where this is exactly the correct behavior, so we may end up closing this with an "As Designed" label, but it's nonetheless surprising. Guides falling back to their platform is very intuitive. One platform falling back to another is much less so. I don't totally have an answer here, but wanted to raise it as a point of discussion for if and when we ever get a docs engineer.

lobsterkatie avatar Mar 22 '22 21:03 lobsterkatie

Do you know if the workaround here is that we'd have to use the notSupported flag as well? This behaviour doesn't make a lot of sense to me either.

imatwawana avatar Mar 24 '22 13:03 imatwawana

Do you know if the workaround here is that we'd have to use the notSupported flag as well?

Yup, that's exactly what we have to do, almost like RN were actually javascript.react-native.

lobsterkatie avatar Mar 25 '22 02:03 lobsterkatie