Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
setFetching(false) not working when displaying extension as a widget

I have an extension that is loading an external website. When the extension loads it just automatically performs a redirect.

<script>
	window.addEventListener('load', function() {
		window.location = 'http://localhost:3000?tct-id=tectonRoute.IframedExtension.Main'
	})
</script>

In my app (the external website that is loaded), I'm connecting to Q2 using the q2-tecton-sdk library and then calling setFetching(false).

import {connect } from 'q2-tecton-sdk';

connect().then((tecton) => {
  tecton.actions.setFetching(false)
})

This works fine when I load the extension as a full page (https://stack.q2developer.com/sdk/rocketmortgage/ardent/uux.aspx#/extension/IframedExtension/Main). It shows the loading icon, loads the page and then the loading icon disappears to show the external website.

However, when I display that extension as a widget (https://stack.q2developer.com/sdk/rocketmortgage/ardent/uux.aspx?widget_location=dashboard.right&widget_name=IframedExtension.Main#/landingPage) it shows the loading icon and connects to Q2 but then the loading icon keeps on spinning forever. I've confirmed that the connection to Q2 has been made by logging a message to the server using tecton.actions.logToServer.

The other option I experimented with is to connect to Q2 from the Tecton extensions JS and call setFetching(false) before performing a redirect.

// frontend/src/index.js

import { connect } from 'q2-tecton-sdk';

async function main() {
  const capabilities = await connect()
  capabilities.actions.setFetching(false)

  window.location.href = "http://localhost:3000?tct-id=tectonRoute.IframedExtension.Main" 
}

main()

This partially worked but I noticed that it wouldn't always display the page. It seemed like the redirect was happening too quickly. I tested adding a setTimeout and that seemed to work better.

import { connect } from 'q2-tecton-sdk';

async function main() {
  const capabilities = await connect()
  capabilities.actions.setFetching(false)

  setTimeout(() => {
    window.location.href = "http://localhost:3000?tct-id=tectonRoute.IframedExtension.Main" 
  }, 1000)
}

main()

Again, this seems to work fine when viewing the extension as a full page. But when I would display it as a widget, it would load but it wasn't responsive. Resizing the window wouldn't affect the size of the iframe like it did when viewing the extension as a full page.

Using the setTimeout also feels a bit icky. I'm wondering if there's a more reliable way to handle this or if I'm missing something.

Posted 4 years ago
Votes Newest

Answers


When you load a Tecton widget, the tct-id changes. In this case you'll want to use:

IframedExtension_Main_widget.IframedExtension.Main
Posted 4 years ago
Mark Ostroth
309 × 5 Administrator
0

Such an easy fix. Thanks Mark, I appreciate the help!

— David Maksimov   4 years ago
184 Views
1 Answer
4 years ago
4 years ago
Tags