Repository navigation
add getReactProps helper and use it for quick-comment-edit - #8793
SunsetTechuila wants to merge 12 commits into
Conversation
This opens a path to reusing and patching GitHub's webpack modules, but it does require some architectural changes
This is easier to implement but offers fewer possibilities
However, I don't think we can completely avoid it. As the React rewrite continues, we'll have to drop more and more features without it, and the remaining ones will become increasingly hard to maintain unless they're very basic |
I'm ok with keeping only small refinements around. New features have been easy to write, but maintenance is a different story. If features no longer fit the bill, then they should go. As always, Refined GitHub doesn't have to do everything, features can live in additional extensions.
Not going to happen, this would just open a bag of worms when most features wouldn't benefit from this. Unfortunately I've never published a helper to simplify safe/unsafe world communication. https://github.com/fregante/GhostText/blob/63daa079b651babd532af44df21cca5c6b831f9d/source/advanced-editors-messenger.js#L10-L12 has an example though. My suggestion would be to implement a simple "main-world.js" script that adds a When the content script fires a bubbling You can see how GhostText "returns" the object, there's no serialization involved: The approach is interesting, especially if it allows to restore important features like the 2 you mentioned. If accepted, this would need some documentation and some debugging tools or else no one can use this new helper. As for the class, I'm not a fan of it. I expect |
These methods are mainly for stability - I think it's reasonable not to depend on exact prop names
You can do that. In this case we're looking for two hooks: |
|
Yes, this was predictable since objects are passed by reference, which would not be valid in another isolated memory context. I thought maybe they would be copied from one to another in this case, but of course, they are not |
Indeed, how about a second window.dispatchEvent(new CustomEvent('rgh:call', {detail: 'props.whatever.edit'}))
We always depend on the exact prop names, see classnames, data-testid, general DOM structure, etc, etc.
Exact method calls seem very reasonable to me. What if they add |
Not really. You can't transfer functions and class instances, but you can transfer arrays and objects as long as they don't contain them. Very interesting |
856a93a to
ecc1644
Compare
|
Waiting for general feedback before continuing |
|
This is growing into something that just isn't Refined GitHub anymore. Again if something requires this much complexity, we just don't do it. Closing for now, sorry. I don't want you to spend time on this and I can't review it. |



Please let me know right away if you don't find this approach feasible, so I won't waste my time finalizing it.
This doesn’t work yet because React props are only available in the main world. We have to either move the content script to the main world, or
getReactPropsand call hooks via RPC. Some adblockers access React props too, but I haven’t looked into how they do it yet.Pull requests that can benefit from this helper: #8777, #8790
Test URLs
Screenshot