theruss

@nightjarnz It occurred to me while typing that I had heard tell of this JS injector sorcery. (Other than that, I hadn't been aware of it) Then @null pointed me to it right after.

😂 (1)
null

Is that was this is meant to solve? https://github.com/silverstripe/react-injector

Show 1 attachment(s)
GitHub  
silverstripe/react-injector

Contribute to silverstripe/react-injector development by creating an account on GitHub.

Hide attachment content
nightjarnz

This is why SilverStripe has the javascript Injector @theruss - the answer to your initial question is "Not normally, no."

theruss

Is there a way to extend a React app, without actually editing its source files? E.g. by compiling it, which consumes additional source files from a different directory perhaps.

I need a way to tweak an existing GraphQL query() in one codebase, by "overriding" or "overloading" React/JS logic found in another.

My problem is this: Codebase A is based on Codebase B. Both codebases are essentially the same SilverStripe/React app combo, but where I wish to have selected frontend changes to persist in Codebase A without those changes ever existing in Codebase B, and permitting changes in B to be rebased onto (or pulled/merged/injected/whatever) into A.

Both codebases exist in separate VCS repos. Neither Codebase A nor B are composer deps - and even if they were, as far as my brain allows, I'd still have the same problem: Needing to "inject" changes into Codebase A's React frontend, while peacefully co-existing on top of Codebase B's React frontend.

I know the following aren't possible, but hopefully they help frame the problem better:

  • React class inheritance (Yes, AFAIK, this isn't how React is designed - just saying)
  • Allowing GraphQL wildcards in query{} calls (Yes, I know, GraphQL isn't designed to allow that - I read this thread and laughed/ranted a lot: https://github.com/graphql/graphql-spec/issues/127)
  • Something else that's hacky AF

Thanks 🙂

Show 2 attachment(s)
GitHub  
Query all fields of a type in a simple expression [wildcard] · Issue #127 · graphql/graphql-spec

Let us say this is the type : type Human { id: String name: String homePlanet: String } Then to query all the fields the query is : query HumanNameQuery { Human { id name homeplanet } } Should be s...

GitHub  
Query all fields of a type in a simple expression [wildcard] · Issue #127 · graphql/graphql-spec

Let us say this is the type : type Human { id: String name: String homePlanet: String } Then to query all the fields the query is : query HumanNameQuery { Human { id name homeplanet } } Should be s...

Hide attachment content
kinglozzer

Just 2 hours wasted profiling stuff wondering where the delay was coming from