This resolves a leak where SentryNonRecordingSpan are pilled up when tracingSampleRate is set to 0. Theoretically SentryNonRecordingSpan are still treated as spans and added to the spans list, but never removed
By moving shouldCreateSpanResult closer to the actual span logic, this is now resolved.
Note
The pull request "fix(core,browser): Delete SentryNonRecordingSpan from fetch/xhr map" was created by @JPeer264 but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.
This resolves a leak where
SentryNonRecordingSpanare pilled up whentracingSampleRateis set to0. TheoreticallySentryNonRecordingSpanare still treated as spans and added to thespanslist, but never removedBy moving
shouldCreateSpanResultcloser to the actual span logic, this is now resolved.