@unitedstatespowersquadrons/components 1.2.10 → 1.2.11-debug.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,9 +17,7 @@ export default function buildReducer<AppState, AppAction>(
17
17
  const DispatchContext = createContext<React.Dispatch<AppAction> | null>(null);
18
18
  const CableContext = createContext<Cable | null>(null);
19
19
 
20
- const actionCableMetaTag: HTMLMetaElement | null = document.querySelector('meta[name="action-cable-url"]');
21
- const actionCableUrl = actionCableMetaTag?.content;
22
- const cable = actionCableUrl ? createConsumer(actionCableUrl) : null;
20
+ const cable = createConsumer(); // DEV: This should be able to implicitly get the meta tag
23
21
 
24
22
  function AppProvider(props: InitialAppProps<AppState>) {
25
23
  const [providerState, dispatch] = useImmerReducer(reducer, props.initialState, (state: AppState) => {
@@ -66,9 +64,14 @@ export default function buildReducer<AppState, AppAction>(
66
64
  const channelRef = useRef<Channel>(null);
67
65
 
68
66
  useEffect(() => {
67
+ console.log({ subscribingTo: channel });
69
68
  channelRef.current = appCable.subscriptions.create(
70
69
  { channel },
71
- { received: (data: object) => dispatch({ data, type: "receivedCable" } as CableAction) }
70
+ {
71
+ connected: () => console.log({ connected: true }),
72
+ received: (data: object) => dispatch({ data, type: "receivedCable" } as CableAction),
73
+ rejected: (data: object) => console.log({ data }),
74
+ }
72
75
  );
73
76
  }, [appCable, channel, dispatch]);
74
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.10",
3
+ "version": "1.2.11-debug.2",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {