[WC-3452] Add pusher module to the repo#2258
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4cd3a12 to
56a23fa
Compare
This comment has been minimized.
This comment has been minimized.
56a23fa to
fd463f9
Compare
This comment has been minimized.
This comment has been minimized.
fd463f9 to
acfb4d9
Compare
acfb4d9 to
fab3036
Compare
This comment has been minimized.
This comment has been minimized.
fab3036 to
f95239d
Compare
This comment has been minimized.
This comment has been minimized.
4d1b69c to
9429277
Compare
AI Code Review
What was reviewed
Skipped (out of scope):
Findings🚨 High — Private symbol access to extract entity nameFile: // Remove this function and its caller. Channel naming must not rely on
// private SDK symbols. Either receive the channel name explicitly as a
// widget property (type="string"), or derive it purely from object.id.
function extractEntityName(object: ObjectItem): string {
const mxObj = (object as any)[Object.getOwnPropertySymbols(object)[0]];
...
}🔶 Medium — Unsubscribe/resubscribe on every renderFile: export function usePusherSubscribe(subscription?: SubscriptionConfig): void {
const [listener, setListener] = useState<PusherListener | null>(null);
const subscriptionRef = useRef(subscription);
// Keep ref current without triggering effect
useLayoutEffect(() => {
subscriptionRef.current = subscription;
});
// Only re-subscribe when listener or channelName changes
useEffect(() => {
if (!listener) return;
const sub = subscriptionRef.current;
if (!sub) { listener.unsubscribe(); return; }
listener.subscribe(sub);
return () => { listener.unsubscribe(); };
}, [listener, subscription?.channelName]); // ← channel name is stable; handlers update via ref
}🔶 Medium — Placeholder unit test with no real coverageFile:
import { render } from "@testing-library/react";
import { EditableValueBuilder } from "@mendix/widget-plugin-test-utils";
import { getChannelName } from "../utils/getChannelName";
describe("getChannelName", () => {
it("returns undefined when objectSource has no value", () => {
const source = new EditableValueBuilder<ObjectItem>().isLoading().build() as any;
expect(getChannelName(source)).toBeUndefined();
});
// ...
});🔶 Medium —
|
This adds pusher module to the repo, has old widget as an asses to copy into the module.