Skip to content
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
4 changes: 2 additions & 2 deletions packages/plugin-tools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/plugin-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@builder.io/plugin-tools",
"version": "0.0.9",
"version": "0.0.10",
"description": "",
"keywords": [],
"main": "dist/index.umd.js",
Expand Down
26 changes: 23 additions & 3 deletions packages/plugin-tools/src/editors/ResourcesPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TextField,
Typography,
} from '@material-ui/core';
import { Create, Search } from '@material-ui/icons';
import { Close, Create, Search } from '@material-ui/icons';
import { runInAction, action } from 'mobx';
import { useObserver, useLocalStore } from 'mobx-react';
import React, { useEffect } from 'react';
Expand Down Expand Up @@ -304,11 +304,11 @@ export const ResourcesPickerButton: React.FC<ResourcesPickerButtonProps> = props
position: 'relative',
}}
>
<ResourcePreviewCell button css={{ paddingRight: 30 }} resource={store.resourceInfo} />
<ResourcePreviewCell button css={{ paddingRight: 70 }} resource={store.resourceInfo} />
<IconButton
css={{
position: 'absolute',
right: 2,
right: 42,
top: 0,
bottom: 0,
height: 50,
Expand All @@ -321,6 +321,26 @@ export const ResourcesPickerButton: React.FC<ResourcesPickerButtonProps> = props
>
<Create css={{ color: '#888' }} />
</IconButton>
<IconButton
css={{
position: 'absolute',
right: 2,
top: 0,
bottom: 0,
height: 50,
marginTop: 'auto',
marginBottom: 'auto',
opacity: 0.7,
}}
onClick={action(() => {
store.resourceHandle = undefined;
store.resourceId = undefined;
store.resourceInfo = null;
props.onChange(null);
})}
>
<Close css={{ color: '#888' }} />
</IconButton>
</Paper>
)}
{!store.resourceInfo && !store.loading && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface CustomReactEditorProps<T = any> {
value?: T;
onChange(val: T | undefined): void;
onChange(val: T | undefined | null): void;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

value type excludes null despite onChange accepting it

Medium Severity

The onChange signature was updated to accept null, but value remains typed as T | undefined (via the ? modifier). After calling onChange(null), the framework will likely set value to null on re-render, but the type doesn't reflect this. Consumers checking typeof value === 'undefined' to detect an unset state (as done in ResourcesList.tsx) would incorrectly treat null as a set value. The value type needs to include null to match the onChange contract.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9e09605. Configure here.

context: any;
field?: any;
}
100 changes: 94 additions & 6 deletions plugins/commercelayer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions plugins/commercelayer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@builder.io/plugin-commercelayer",
"version": "0.1.5",
"version": "0.1.6",
"description": "Commerce Layer plugin for Builder.io",
"keywords": [],
"main": "dist/plugin.system.js",
Expand All @@ -27,6 +27,7 @@
"release:patch": "npm run build && npm version patch --no-git-tag-version && npm publish"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-replace": "^5.0.5",
Expand All @@ -41,6 +42,6 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@builder.io/plugin-tools": "0.0.9"
"@builder.io/plugin-tools": "0.0.10"
}
}
7 changes: 5 additions & 2 deletions plugins/commercelayer/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import replace from '@rollup/plugin-replace';
import serve from 'rollup-plugin-serve';
import esbuild from 'rollup-plugin-esbuild';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { readFileSync } from 'fs';

Expand All @@ -15,6 +16,7 @@ export default {
external: [
'react',
'@builder.io/react',
'@builder.io/sdk',
'@builder.io/app-context',
'@material-ui/core',
'@emotion/core',
Expand All @@ -34,9 +36,10 @@ export default {
preventAssignment: true
}),
json(),
nodeResolve({
nodeResolve({
mainFields: ['module', 'browser']
}),
commonjs(),
esbuild(),

...(SERVE
Expand All @@ -53,4 +56,4 @@ export default {
]
: []),
],
}
}
Loading