Skip to content

refactor: overhaul of the ComponentDemo, split into multiple files, i…#968

Merged
MatthewHawkins merged 8 commits into
mainfrom
component-demo-overhaul-1
May 13, 2026
Merged

refactor: overhaul of the ComponentDemo, split into multiple files, i…#968
MatthewHawkins merged 8 commits into
mainfrom
component-demo-overhaul-1

Conversation

@MatthewHawkins
Copy link
Copy Markdown
Member

…mproved file passing, fixed bugs and logical errors, and updated markdown files for new props usage

…mproved file passing, fixed bugs and logical errors, and updated markdown files for new props usage
Comment thread docs/docs/components/table/table_sorting.md Outdated
Copy link
Copy Markdown
Member

@gosteenBASIS gosteenBASIS left a comment

Choose a reason for hiding this comment

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

As far as I can tell, this all looks good. Clicked through all the pages and checked that the demo viewers all work, and the source code changes look reasonable to me.

I did run into a couple problems when building/running this branch, which I haven't run into before. They were mostly resolved by just cleaning/rebuilding, but I'm noting them here in case they're indicative of any issues, or if the problems occur when we merge this branch:

My first mvn jetty:run didn't work, and warned me that 14 files had "format violations," and it prompted me to run mvn spotless:apply to fix them. I did this, which fixed the problems. These were all Java files in the webforj/samples/views directory. login/LoginBasicView.java, table/renderers/Invoice.java, splitter/SplitterBasicView.java, among others. These files all showed up as "unstaged changes" in my git client, but when I tried to see what the difference was, none of them had any detectable differences. Not sure what any of this is about, or what the format violations were.

I also encountered an issue I hadn't seen before, where the doc site rendered without any styling, with everything in the browser's default font and no layouts or anything. Did a clean, a clear, and a rebuild, and it was fixed.

Possibly these were idiosyncratic to my local environment in some way. In any case, the issues were easily fixed, so I'm approving and leaving the info here for the record.

@MatthewHawkins
Copy link
Copy Markdown
Member Author

@gosteenBASIS Thanks for the detailed review - that first issue was a plugin Eric was working on to enforce good code styling. That second one is strange, but not something that sounds related to this change. Thanks for looking everything over

Copy link
Copy Markdown
Member

@bbrennanbasis bbrennanbasis left a comment

Choose a reason for hiding this comment

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

  1. Now that ComponentDemo has its own folder, and the code is split into three JavaScript files, should the CSS be kept separately, like for AskMenu and ExpandableCode?

  2. Possibly a remanent from the original component, but mobile/tablet component demos with a scrollbar don't render ideally.

Image
  1. Were any of the existing open Issues for ComponentDemo going to be resolved in this PR?
  • #70 (Paths seem to work without the appended '?', but are still present)
  • #67
  • #747
  • #298 (Partially implemented, but an error for a broken link only happens during runtime)

Comment thread docs/siteConfig.js Outdated
const GLOBALS = {
IFRAME_SRC_LIVE: "",
IFRAME_SRC_DEV: "http://localhost:8080"
IFRAME_SRC_DEV: "http://localhost:8080",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't realize 8080 was still hardcoded in parts of the project, but should be configurable after the changes from PR #754

Comment on lines +65 to +81

async function loadInto(url) {
try {
const response = await fetch(url, { signal: controller.signal });
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
const text = await response.text();
setLoadedFiles((prev) => ({ ...prev, [url]: text }));
} catch (err) {
if (err.name === 'AbortError') return;
console.error(`ComponentDemo: failed to load ${url}`, err);
setLoadedFiles((prev) => ({
...prev,
[url]: `// Failed to load ${url}\n// ${err.message}`,
}));
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I had only gotten this error when I ran the build and went to a page with the broken link, was this suppose to validate the links when attempting to check a successfully build?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope, this was because we weren't doing any logging or warning if there was a broken link before, even on deploy, so now there's at least a warning. The warning during development isn't something I tackled this go around.

urls={['https://raw.githubusercontent.com/webforj/webforj-documentation/refs/heads/main/src/main/java/com/webforj/samples/views/table/MusicRecord.java',
'https://raw.githubusercontent.com/webforj/webforj-documentation/refs/heads/main/src/main/java/com/webforj/samples/views/table/Service.java']}
<ComponentDemo
path='/webforj/tablemultisorting'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [vale] reported by reviewdog 🐶
[webforJ.Capitalization] Use 'webforJ' instead of 'webforj'.

@MatthewHawkins
Copy link
Copy Markdown
Member Author

closes #70 #67

@MatthewHawkins MatthewHawkins merged commit 7a8259e into main May 13, 2026
1 of 2 checks passed
@MatthewHawkins MatthewHawkins deleted the component-demo-overhaul-1 branch May 13, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants