Skip to content

Commit

Permalink
fix: remove destroy method from context
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinechassagne committed Aug 3, 2023
1 parent d5e8742 commit 96f4b51
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
5 changes: 1 addition & 4 deletions src/Elements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ const Elements = forwardRef(({
});
const {
lib,
factory:
globalFactory,
factory: globalFactory,
createFactory,
destroyFactory,
} = useEngage();

useImperativeHandle(ref, () => ({
Expand Down Expand Up @@ -54,7 +52,6 @@ const Elements = forwardRef(({

const destroy = async () => {
await Promise.all(state.elements.map(element => element.destroy()));
destroyFactory();
state.elements = [];
};

Expand Down
9 changes: 0 additions & 9 deletions src/EngageContext/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ const EngageContext = ({
return factory;
};

const destroyFactory = () => {
if (!state.factory) {
return;
}

dispatch({ factory: null });
};

const commitPageView = () => {
if (!state.factory) {
return;
Expand All @@ -94,7 +86,6 @@ const EngageContext = ({
lib: state.lib,
factory: state.factory,
createFactory,
destroyFactory,
commitPageView,
}), [state.lib, state.factory]);

Expand Down

0 comments on commit 96f4b51

Please sign in to comment.