apostrophecms / apostrophecms/apostrophe

Singleton field in schema of apostrophe-pieces-widgets fails to retrieve image after saving widget

Open
#2,704 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## To Reproduce

Step by step instructions to reproduce the behavior:

> 1. Add a singleton field to your pieces-widgets schema and set it to be an apostrophe-images type
> 2. In the widget template, setup the code to grab the image and then render out the attachment url
> 3. Inside of your widget, add the image to your field you added earlier
> 4. Save the widget
> 5. Then you will see the red missing image icon error in the template
> 6. Wait for the "Saved!" message in the bottom left
> 7. Refresh the page, you will now see the image rendering completely normal
> 8. Go edit the widget again, and either just re-save it, or change the image and save the widget again
> 9. See error again

## Expected behavior
> I would expect the image to just update or render normally after each save of the widget, not just on page load.

## Describe the bug
> With apostrophe-pieces-widgets where if I add an apostrophe-images singleton field to the widget schema, then if I save the widget, I get the missing image error icon. But if I refresh the page, the image shows completely fine. Then if I go into the widget and re-save/make any changes and save the widget, the missing image error occurs again.

## Details

**Version of Node.js:**
v12.19.0

**Server Operating System:**
MacOS Catalina V 10.15.7

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with an apostrophe-images singleton field in an apostrophe-pieces-widgets schema, then trace the widget save and image-rendering paths. Done means the image renders normally immediately after every widget save without requiring a page refresh.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.