getting runtime error like - object unsubscribed Error

14 Views Asked by At

I am trying to show the data in fixmessage grid that time i am getting error like - object unsubscribed Error.
Below is the code I am using getting the runtime error what i mention the above.

getting runtime error like - object unsubscribed Error.

give any idea on this.

import {memo, React, useEffect, useMemo, useRef, useState} from 'react';
import "ag-grid-enterprise";
import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-material.css';
import {fetchTagNameDict} from "../utils";
import {ClientConfigType, DataClientProvider, useDataClientManager} from '@marketsui/data-client';
import {
    Blotter,
} from '@marketsui/blotter';
//TODO - See a better way of getting rid of below warning instead of adding overrides
import axios from "axios";
import {fixMessageGridSchemaConfig} from './fixMessageGridSchema'

const FixMessageGrid = memo(function GridPanelMemo(props) {

        const blotterId = 'reject-blotter-id';
        const blotterTopic = 'reject-blotter-Topic';
        const dataClientTopic = 'rest-data-client-topic';
        const sourceDataClientId = 'rest-data-client-id';

        const getTagValueNameData = (value, tagNameDict) => {

            if (value.includes('=')) {

                const tagAndValue = value.split("=")
                // console.log(tagNameDict[tagAndValue[0]].toString())
                return ({
                    'tag': tagAndValue[0],
                    'value': tagAndValue[1],
                    'tagName': tagNameDict[tagAndValue[0]]
                });
            } else {
                return null;
            }
        }


        const getDelim = (message) => {
            let firstCut = message.split("=", 2)[1];
            let subString = firstCut.substring(3, firstCut.length);
            let delim = subString.replace(/[0-9.]/g, '');
            return delim;
        }

        const fetchCallback = async () => {
            let tagDict = await fetchTagNameDict()
            let data = props.rowData;
            let delim = getDelim(data);
            console.log(delim,"delim data")
            let message = data.split(delim)
            let tagSet = new Set();
            let gridData = []
            message.forEach(segment => {
                if(segment.length !=0) {
                    if (segment.indexOf('\x01') != -1) {
                        segment = segment.substring(0, segment.lastIndexOf('\x01'));
                    }
                    let tagValueNameLabel = getTagValueNameData(segment, tagDict);
                    gridData.push(tagValueNameLabel)
                }

            })
            return gridData
        }

        const dcmConfig = useMemo( () => [
            {
                type: ClientConfigType.rest,
                options: {
                    fetch: fetchCallback,
                    schema: fixMessageGridSchemaConfig,
                },
                topic: dataClientTopic,
                id: sourceDataClientId,
            }], [props.rowData])

        const dcm = useDataClientManager(dcmConfig);

        useEffect(() => {
            const dc = dcm && dcm.getDataClient(dcmConfig[0].id);
            dc?.updateQuery({});
        }, [dcm]);



        const dataGridBaseProps = {
            defaultColDef: {
                maxWidth: 150
            },
        };

        const blotterGridProps = {
            dataGridBaseProps: dataGridBaseProps,
            componentId: blotterId,
            blotterTopic: blotterTopic,
            dataClientId: sourceDataClientId
        }

        return (

            <div style={{height: '400px'}}>
                {dcm && (
                    <DataClientProvider dataClientManager={dcm}>
                        <Blotter blotterGridProps={blotterGridProps}
                        />
                    </DataClientProvider>
                )}
            </div>
        )
    }
)

export default FixMessageGrid;

I want to show the data in fixmessage grid how to do that

0

There are 0 best solutions below