microsoft / microsoft/nova-facade
Feature request: Enable nova data façade to support partial implementations of the interface
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 24
- Forks
- 27
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 3
Description
Hi,
Scenario
Org Explorer is an Apollo graphql people experience (aka.ms/orgexplorer) where my team integrated People Highlights (ref on scenario here). Our integration package is implementing the nova data interface.
Background info
Today highlights are integrated in the host app (OrgX) root query. OrgX is a NON-nova host app. Highlights type is embedded inside OrgX root query making the implementation of useLazyLoadQuery difficult. so far we opted for implementing the following methods, while querying happens inside the host app and then it's passed down as props:
useMutation- this works well because highlights are not embedded in the orgx root mutation (it's decoupled)useFragment- we are relying on the default implementation where data passed via props is mirrored.
Challenge
Since data is passed down via props, we can't ensure proper usage of useFragment unless we extract from the Fragment$key the data and forcefully cast it to a ref.
const highlightRef = props.personaHighlightFragment[" $data"] as unknown as {
readonly " $fragmentRefs": FragmentRefs<"HighlightsFragment">;
};
where personaHighlightFragment is a Nova fragment constructed this way (on the host app)
// Convert from Apollo fragment to Nova(Relay) fragment
const personaHighlightFragment: NovaHighlightsFragment$key = {
" $fragmentRefs": { HighlightsFragment: true },
" $data": personaHighlight as NovaHighlightsFragment,
};
Ask: Enable nova to handle such object transformations when data is not fetched via useLazyLoadQuery but rather passed via props.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Nova data interface and the useFragment, useMutation, and useLazyLoadQuery entry points described in the issue. Determine how partial implementations and props-passed data should be represented without the current casts. Done should mean the Apollo-to-Nova transformation works for this scenario and is covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100