@messenger-box/platform-browser 0.0.1-alpha.113 → 0.0.1-alpha.114

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.0.1-alpha.114](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.113...v0.0.1-alpha.114) (2022-01-10)
7
+
8
+ **Note:** Version bump only for package @messenger-box/platform-browser
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.0.1-alpha.113](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.112...v0.0.1-alpha.113) (2022-01-08)
7
15
 
8
16
  **Note:** Version bump only for package @messenger-box/platform-browser
package/lib/index.js CHANGED
@@ -1392,7 +1392,6 @@ const react_router_dom_1 = __webpack_require__(/*! react-router-dom */ "react-ro
1392
1392
  const Messenger_1 = __importDefault(__webpack_require__(/*! ../../containers/Messenger */ "./src/containers/Messenger.tsx"));
1393
1393
  const PublicChannelView = () => {
1394
1394
  const his = react_router_dom_1.useHistory();
1395
- console.log('-=-=-=-=-=', his);
1396
1395
  return (React.createElement("div", { className: "main_wraper" },
1397
1396
  React.createElement(react_intl_1.IntlProvider, { locale: "en" },
1398
1397
  React.createElement("div", { className: 'chat_head_mid' },
@@ -1686,6 +1685,7 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1686
1685
  variables: {
1687
1686
  channelId: channel.id,
1688
1687
  },
1688
+ fetchPolicy: "cache-first"
1689
1689
  });
1690
1690
  // useEffect(() => {
1691
1691
  // if (isRefetch) {
@@ -1701,8 +1701,17 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1701
1701
  }
1702
1702
  }, [loading, data]);
1703
1703
  const [sendMsg, sentMessage] = core_1.useSendMessagesMutation({
1704
- // context: {headers: {Authorization: token}},
1705
- // refetchQueries: ['GetMessages']
1704
+ update: (cache, mutationResult) => {
1705
+ cache.modify({
1706
+ fields: {
1707
+ messages(existingMessages, { toReference }) {
1708
+ return Object.assign(Object.assign({}, existingMessages), { data: toReference(mutationResult.data.sendMessage) });
1709
+ }
1710
+ }
1711
+ });
1712
+ },
1713
+ // context: {headers: {Authorization: token}},
1714
+ // refetchQueries: ['GetMessages']
1706
1715
  });
1707
1716
  const handleEnterButton = (e) => {
1708
1717
  if (enterValue) {
@@ -2750,23 +2759,38 @@ const bs_1 = __webpack_require__(/*! react-icons/bs */ "react-icons/bs");
2750
2759
  const io5_1 = __webpack_require__(/*! react-icons/io5 */ "react-icons/io5");
2751
2760
  const antd_1 = __webpack_require__(/*! antd */ "antd");
2752
2761
  const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
2762
+ const react_router_dom_1 = __webpack_require__(/*! react-router-dom */ "react-router-dom");
2753
2763
  const PostViewPage = ({ channel, currentUsrId }) => {
2754
2764
  const { css } = react_fela_1.useFela();
2765
+ const his = react_router_dom_1.useHistory();
2755
2766
  const [deleteChannel, deleteChannelResponse] = core_1.useDeleteChannelMutation({
2756
- update: (cache, mutationResult) => {
2757
- cache.modify({
2758
- fields: {
2759
- channels(existingChannels, { toReference }) {
2760
- return [...existingChannels.filter(i => i !== mutationResult.data.deleteChannel)];
2761
- }
2762
- }
2763
- });
2764
- },
2767
+ // update: (cache, mutationResult) => {
2768
+ // const normalizedId = cache.identify({ ChannelId, __typename: 'Channel' });
2769
+ // cache.evict({ id: normalizedId });
2770
+ // cache.gc();
2771
+ // cache.modify({
2772
+ // fields: {
2773
+ // channels(existingChannels, {toReference}) {
2774
+ // return [...existingChannels.filter(i => i !== mutationResult.data.deleteChannel)]
2775
+ // }
2776
+ // }
2777
+ // })
2778
+ // },
2765
2779
  });
2766
2780
  const hendleDelete = async () => {
2767
2781
  await deleteChannel({
2768
2782
  variables: {
2769
2783
  ChannelId: channel.id
2784
+ },
2785
+ update(cache) {
2786
+ cache.modify({
2787
+ fields: {
2788
+ channels(existingChannels = [], { readField }) {
2789
+ return existingChannels.filter(postRef => channel.id !== readField('id', postRef));
2790
+ },
2791
+ },
2792
+ });
2793
+ his.push(`/o/${his.location.pathname.split('/')[2]}/dashboard`);
2770
2794
  }
2771
2795
  });
2772
2796
  };
@@ -23987,7 +24011,7 @@ exports.styleSheet = {
23987
24011
  '> li': {
23988
24012
  float: 'left',
23989
24013
  position: 'relative',
23990
- display: 'block',
24014
+ display: 'flex',
23991
24015
  width: '100%',
23992
24016
  '> h4': {
23993
24017
  fontSize: '1.1em',