-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make fixture list updates more resilient in lazy mode (#1474)
* Don't override playground fixture with renderer fixture * WIP: Make fixture list updates more resilient in lazy mode * Remove fixtureListItemUpdate renderer response * Only store one lazy item at a time * Update index.tsx
- Loading branch information
Showing
19 changed files
with
162 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/react-cosmos-renderer/src/rendererConnect/RendererProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use client'; | ||
import React from 'react'; | ||
import { | ||
FixtureList, | ||
RendererConnect, | ||
RendererSearchParams, | ||
} from 'react-cosmos-core'; | ||
import { RendererContext } from './RendererContext.js'; | ||
|
||
export type Props = { | ||
children: React.ReactNode; | ||
rendererId: string; | ||
rendererConnect: RendererConnect; | ||
searchParams: RendererSearchParams; | ||
setSearchParams(nextParams: RendererSearchParams): void; | ||
reloadRenderer(): void; | ||
}; | ||
export function RendererProvider(props: Props) { | ||
const [lazyItems, setLazyItems] = React.useState<FixtureList>({}); | ||
|
||
const value = React.useMemo(() => { | ||
return { | ||
rendererId: props.rendererId, | ||
rendererConnect: props.rendererConnect, | ||
searchParams: props.searchParams, | ||
setSearchParams: props.setSearchParams, | ||
reloadRenderer: props.reloadRenderer, | ||
lazyItems, | ||
setLazyItems, | ||
}; | ||
}, [ | ||
lazyItems, | ||
props.reloadRenderer, | ||
props.rendererConnect, | ||
props.rendererId, | ||
props.searchParams, | ||
props.setSearchParams, | ||
]); | ||
|
||
return ( | ||
<RendererContext.Provider value={value}> | ||
{props.children} | ||
</RendererContext.Provider> | ||
); | ||
} |
Oops, something went wrong.