Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update info #12382

Merged
merged 6 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import assert from 'assert'
import * as actions from './actions'
import { computedContent } from './css'
import { expect } from './customExpect'
import { mockExpressionUpdate } from './expressionUpdates'
import { CONTROL_KEY } from './keyboard'
import * as locate from './locate'

test('Node can open and load visualization', async ({ page }) => {
await actions.goToGraph(page)
const node = locate.graphNode(page).last()
const node = locate.graphNodeByBinding(page, 'final')
await node.click({ position: { x: 8, y: 8 } })
await expect(locate.componentMenu(page)).toExist()
await locate.toggleVisualizationButton(page).click()
Expand All @@ -24,6 +25,12 @@ test('Node can open and load visualization', async ({ page }) => {
const textContent = await computedContent(element)
const jsonContent = JSON.parse(textContent)
expect(typeof jsonContent).toBe('object')
const nodeType = await locate.visualisationNodeType(page)
await expect(nodeType).toHaveText('Unknown')
await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.Table'] })
await expect(nodeType).toHaveText('Table')
await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.DifferentType'] })
await expect(nodeType).toHaveText('DifferentType')
})

test('Previewing visualization', async ({ page }) => {
Expand Down
5 changes: 5 additions & 0 deletions app/gui/integration-test/project-view/locate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export const geoMapVisualization = visualizationLocator('.GeoMapVisualization')
export const imageBase64Visualization = visualizationLocator('.ImageBase64Visualization')
export const warningsVisualization = visualizationLocator('.WarningsVisualization')

/** Type label on the visualisation */
export function visualisationNodeType(page: Page) {
return page.getByTestId('visualisationNodeType')
}

// === Edge locators ===

/** All edges going from a node with given binding. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ useEvent(window, 'pointerup', (e) => interaction.handlePointerEvent(e, 'pointeru
<div
class="after-toolbars node-type"
:title="props.typename ?? UNKNOWN_TYPE"
data-testid="visualisationNodeType"
v-text="nodeShortType"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ export class ComputedValueRegistry {
processUpdates(updates: ExpressionUpdate[]) {
for (const update of updates) {
const info = this.db.get(update.expressionId)
if (update.payload.type == 'Pending' && update.payload.progress == -1.0) {
// just update the payload
if (info) {
info.payload = update.payload
}
continue
}
if (info) updateInfo(info, update, this.projectNames)
else this.db.set(update.expressionId, combineInfo(undefined, update, this.projectNames))
}
Expand All @@ -86,9 +79,18 @@ function updateInfo(
) {
const newInfo = combineInfo(info, update, projectNames)
if (newInfo.typename !== info.typename) info.typename = newInfo.typename
if (newInfo.rawTypename !== info.rawTypename) info.rawTypename = newInfo.rawTypename
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at this line today! And I haven't noticed missing rawTypename assignment in this "copy" updater.

if (newInfo.methodCall !== info.methodCall) info.methodCall = newInfo.methodCall
if (newInfo.payload !== info.payload) info.payload = newInfo.payload
if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = update.profilingInfo
if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = newInfo.profilingInfo
// Ensure new fields can't be added to `ExpressionInfo` without this code being updated.
const _allFieldsHandled = {
typename: newInfo.typename,
rawTypename: newInfo.rawTypename,
methodCall: newInfo.methodCall,
payload: newInfo.payload,
profilingInfo: newInfo.profilingInfo,
} satisfies ExpressionInfo
}

/**
Expand Down
Loading