Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Stories): add hook for sync tabs #138

Merged
merged 4 commits into from
Feb 5, 2024
Merged

Conversation

eyoue
Copy link
Contributor

@eyoue eyoue commented Feb 1, 2024

UXRFC-300.
Perform action in multiple tabs simultaneously using Local Storage key and 'storage' event listener.

@eyoue eyoue requested a review from DarkGenius as a code owner February 1, 2024 09:02
@eyoue eyoue changed the title feat(Storues): add hook for sync tabs feat(Stories): add hook for sync tabs Feb 1, 2024
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@@ -48,13 +51,21 @@ export function Stories({
[onClose],
);

const {callback: closeWithLS} = useSyncWithLS<NonNullable<StoriesProps['onClose']>>({
callback: (event, reason) => {
if (syncInTabs) onClose?.(event, reason);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to check syncInTabs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tnx, fixed.

@@ -62,6 +62,7 @@ const DefaultTemplate: StoryFn<StoriesProps> = (props: StoriesProps) => {
<Stories
{...props}
open={visible}
syncInTabs={props.syncInTabs}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above, with the restructuring of props, syncInTabs also will be set, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, right. Fixed.

@eyoue eyoue merged commit a70afd5 into main Feb 5, 2024
3 checks passed
@eyoue eyoue deleted the add_sync_hook_for_stories branch February 5, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants