sourcegraph/browser-extensions

Extensions do not get reinited when browsing from blob page to blob page on GitHub

sqs opened this issue ยท 4 comments

sqs commented

Repro (in latest=1.13.0 and prior versions):

  1. Enable the Sourcegraph extensions feature flag
  2. Go to https://github.com/theupdateframework/notary/blob/fb795b0bc868746ed2efa2cd7109346bc7ddf0a4/server/storage/rethinkdb.go
  3. WITHOUT performing a hard page reload, click to another file (eg storage in the breadcrumb and then tuf_store.go)

Actual: no code intel hovers or contributions show up on the blob (although the command list does appear), but if you reload they all show up correctly
Expected: they all show up correctly without needing to reload

sqs commented

@chrismwendt another user just reported this too

Oops, I forgot to post this comment earlier:

It looks like delete window.sx is failing. Here's the console output:

inject.tsx:297 could not get feature flag TypeError: Cannot delete property 'sx' of #<Window>
    at createController (controller.js:133)
    at injectCodeIntelligence (inject.tsx:135)
    at inject.tsx:289

The only explanation I found for this behavior only applies to global variables, not properties, and sx appears to be a property. This article says the error occurs in strict mode https://marcin-chwedczuk.github.io/JavaScript-in-and-delete-operators

What was the reasoning behind Object.defineProperty? In other words, if we switch to window.sx = ... and window.sxenv = ..., will we lose anything?

Switching to window.sx = controller worked โœ…

I kicked off the release https://travis-ci.org/sourcegraph/browser-extensions/builds/427365474 and it should finish in ~10 minutes.

๐ŸŽ‰ This issue has been resolved in version 1.13.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€