Skip to content

I need to destroy the chart #74

@feyzullahyildiz

Description

@feyzullahyildiz

Describe the bug
destroyChart and destroyDashboard functions does not exists. How can I destroy these charts.

import React, { useLayoutEffect, useRef} from 'react';
import ChartsEmbedSDK from '@mongodb-js/charts-embed-dom';
export const App() {
  const divRef = useRef(document.createElement('div'));
  
  
  useLayoutEffect(() => {
    const sdk = new ChartsEmbedSDK({
      baseUrl: 'https://charts.mongodb.com/charts-chartsss-ktjra',
    });
    const chart = sdk.createChart({
      chartId: '137cc4ba-09cb-413e-2226-9e119ff05343',
      getUserToken: () => window.prompt('Type your token') || ''
    });
    chart.render(divRef.current);
    return () => {


      // I need to destroy the chart over here


    }

  }, [])
  return (
    <div className='chart' ref={divRef}></div>
  )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions