Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

FrameConnector returns "This is the OpenAttestation default renderer" #74

@tmarcus68

Description

@tmarcus68

I have created a renderer and hosted it, the renderer is working on opencerts.io.

Now I am trying to use to show the rendered any certificate on my own FE.

The code I use is as follows.

DecentralisedRenderer.js

import React, { useRef, useCallback, useState } from "react";

import { FrameConnector, renderDocument } from "@govtechsg/decentralized-renderer-react-components";

const DecentralisedRenderer = (props) => {
  const toFrame = useRef();
  const SCROLLBAR_WIDTH = 20;
  const [height, setHeight] = useState(0);

  const onConnected = useCallback(
    (frame) => {
      toFrame.current = frame;
      if (toFrame.current) {
        toFrame.current(renderDocument({ document: JSON.parse(props.certificate) }));
      }
    },
    [props.certificate]
  );

  const dispatch = (action) => {
    console.log(action);
    if (action.type === "UPDATE_HEIGHT") {
      setHeight(action.payload + SCROLLBAR_WIDTH);
    }
  };

  return (
    <FrameConnector
      style={{ height: '${height}px`, width: "95%" }}
      source={props.source}
      onConnected={onConnected}
      dispatch={dispatch}
    />
  );
};

export default DecentralisedRenderer;

The component is then called via <DecentralisedRenderer certificate={document} source={renderer} /> with the document being the raw string of the .opencert file selected and source being the renderer URL.

The iframe shows "This is the OpenAttestation default renderer" instead of my custom renderer.

The console.log for "UPDATE_TEMPLATES" is as follows.
{type: 'UPDATE_TEMPLATES', payload: Array(1), meta: undefined} meta: undefined payload: Array(1) 0: {id: 'default-template', label: 'Default', type: 'custom-template'} length: 1 [[Prototype]]: Array(0) type: "UPDATE_TEMPLATES" [[Prototype]]: Object

How can I set my custom template and renderer any certificate on my site? FE is running on react js.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions