• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / ui5-webcomponents-react / 9495457180

13 Jun 2024 07:23AM CUT coverage: 31.508% (-54.8%) from 86.282%
9495457180

Pull #5883

github

web-flow
Merge c3057fa50 into 7a27b7f0a
Pull Request #5883: fix(deps): update dependency @tanstack/react-virtual to v3.5.1

641 of 4086 branches covered (15.69%)

1973 of 6262 relevant lines covered (31.51%)

165.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/packages/main/src/internal/ModalsContext.ts
1
import type { ComponentType, ContextType, Dispatch, RefCallback, RefObject } from 'react';
2
import { createContext, useContext } from 'react';
3

4
export interface UpdateModalStateAction<Props, DomRef, ContainerElement = HTMLElement> {
5
  type: 'set' | 'reset';
6
  payload?: ModalState<Props, DomRef, ContainerElement> | { id: string };
7
}
8

9
export interface ModalState<Props, DomRef, ContainerElement> {
10
  Component: ComponentType;
11
  props: Props;
12
  ref: RefObject<DomRef> | RefCallback<DomRef>;
13
  container: ContainerElement;
14
  id: string;
15
}
16

17
interface IModalsContext<Props, DomRef> {
18
  setModal?: Dispatch<UpdateModalStateAction<Props, DomRef>>;
19
}
20

21
const ModalsContext = createContext<IModalsContext<Record<string, any>, HTMLElement>>({
139✔
22
  setModal: null
23
});
24

25
export function getModalContext() {
26
  if (!globalThis['@ui5/webcomponents-react']?.ModalsContext) {
565✔
27
    globalThis['@ui5/webcomponents-react'] ??= {};
123✔
28
    globalThis['@ui5/webcomponents-react'].ModalsContext = ModalsContext;
123✔
29
  }
30

31
  return globalThis['@ui5/webcomponents-react'].ModalsContext;
565✔
32
}
33

34
export const useModalsContext = (): ContextType<typeof ModalsContext> => {
139✔
35
  return useContext(getModalContext());
×
36
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc