Skip to content

Added automatic screenshot generation when creating a task. - #117

Open
veronika-tseleva-cleantalk wants to merge 3 commits into
devfrom
auto-screenshot
Open

Added automatic screenshot generation when creating a task.#117
veronika-tseleva-cleantalk wants to merge 3 commits into
devfrom
auto-screenshot

Conversation

@veronika-tseleva-cleantalk

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings July 28, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an automatic screenshot capture step during task creation so that newly created “spots” can include a screenshot attachment without requiring a separate user action.

Changes:

  • Trigger fileUploader.makeScreenshot() automatically when submitting the create-task form.
  • Gracefully handle screenshot capture failures (log and continue creating the task).
  • Apply the same change to the built distribution bundle.

Reviewed changes

Copilot reviewed 1 out of 4 changed files in this pull request and generated 1 comment.

File Description
js/src/widget.js Adds an awaited auto-screenshot step prior to building/submitting task payload.
dist/doboard-widget-bundle.js Updates the compiled bundle to include the same auto-screenshot behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread js/src/widget.js Outdated
Copilot AI review requested due to automatic review settings July 28, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

js/src/fileuploader.js:415

  • makeScreenshot() uses console.log for a condition that is effectively a warning/skip path, while the rest of this module uses console.warn/console.error. Keeping log levels consistent also makes it easier to filter production logs.
        if (this.files.length >= this.maxFiles || this.getTotalSize() >= this.maxTotalSize) {
            console.log('SpotFix: File count or total size limit reached. Automatic screenshot cancelled.');
            return;

js/src/fileuploader.js:510

  • The else branch assumes validateFile() failed due to total-size, but validateFile() can also fail due to per-file size or type; additionally it calls showError(), which may display an unexpected UI error for an automatic screenshot. Consider doing a silent constraint check for automatic screenshots instead of calling validateFile(), and use a generic warning if you still want a console message.
            if (this.validateFile(file)) {
                if (this.uploaderWrapper && this.uploaderWrapper.style.display !== 'block') {
                    this.uploaderWrapper.style.display = 'block';
                }

                this.clearError();
                this.addFile(file);
            } else {
                console.warn('SpotFix: Automatic screenshot was not added because the total file size would exceed the limit.');
            }

js/src/widget.js:271

  • This new await makeScreenshot() call means task creation now depends on screenshot capture completing first. Since makeScreenshot() may dynamically load dom-to-image-more from a third-party CDN, task creation can be delayed or fail in environments that block CDN traffic. Consider preloading/bundling the dependency, or making automatic screenshots use only already-bundled code paths (e.g., the html2canvas fallback) to reduce runtime network dependencies.
                if (this.fileUploader && typeof this.fileUploader.makeScreenshot === 'function') {
                    try {
                        await this.fileUploader.makeScreenshot();
                    } catch (screenshotError) {
                        console.error('Failed to capture automatic screenshot:', screenshotError);
                    }
                }

Copilot AI review requested due to automatic review settings July 29, 2026 20:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

js/src/widget.js:954

  • The widget is hidden and screenshot capture is awaited during create-task initialization. Since makeScreenshot() can fetch a screenshot library from a CDN, this can keep the widget invisible (and delay editor setup) for an unpredictable amount of time on first open. Consider running screenshot capture in the background and relying on makeScreenshot()'s existing ignore/filter logic instead of hiding the widget container.
                    try {
                        await this.fileUploader.makeScreenshot();
                    } catch (screenshotError) {
                        console.error('SpotFix: Failed to capture automatic screenshot on open:', screenshotError);
                    } finally {

js/src/fileuploader.js:509

  • This warning message is misleading: validateFile(file) can fail because the screenshot file itself exceeds maxFileSize (not just total size). Either make the message generic or mention both limits so logs match the actual validation outcome.
            } else {
                console.warn('SpotFix: Automatic screenshot was not added because the total file size would exceed the limit.');
            }

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