Umbraco: Missing Save Indicator For Content Variants
Hey guys! Ever run into that super annoying situation where you're saving content in Umbraco, especially when dealing with multiple language versions, and you're left wondering if the system is even doing anything? Yeah, it's a real head-scratcher, and we're diving deep into that today. Specifically, we're talking about the missing visual cue when saving content that varies by language or other configurations in Umbraco. It's like waiting for a watched pot to boil, but without even knowing if the stove is on!
The Pesky Problem: No Visual Feedback
So, the main issue we're tackling is the lack of a visual indicator when saving or publishing content in Umbraco that has variants. Think about it: you've got a site with multiple languages, you're using block grids with tons of content, and sometimes, saving can take a while. Now, if you're saving a node that doesn't vary, you get that sweet, reassuring spinning progress indicator on the button. Ah, peace of mind! But, when you're dealing with content that does vary such as different languages, that spinner vanishes! You're left staring at the screen, tapping your fingers, and questioning all your life choices.
Why This Matters
User Experience Nightmare: Imagine you're a content editor. You've just spent a chunk of time tweaking and perfecting content for different languages. You hit "Save & Publish," and... nothing. No spinner, no confirmation, just a blank stare from the button. Are your changes being saved? Is the system even working? This can lead to frustration, confusion, and a lot of unnecessary clicks.
Potential Data Loss or Corruption: Without a clear indicator, users might assume the save failed and attempt to save again, potentially leading to data corruption or conflicts. It's like that moment when you are not sure if you sent the email so you send it again and the receiver gets it twice.
Lack of Confidence: Ultimately, this missing indicator erodes trust in the system. If content editors aren't confident that their changes are being saved correctly, they're less likely to fully embrace the platform.
Diving into the Details
The Specifics
Let's get down to the nitty-gritty. This problem has been observed in Umbraco version 16.3.0. The core issue is that when you save and publish a content node that varies (e.g., by language), the modal that pops up to choose which languages to publish doesn't provide any visual feedback that something is happening behind the scenes.
Steps to Reproduce the Issue
Want to see this in action for yourself? Here's how you can replicate the problem:
- Create DocTypes: First, you'll need two Document Types. One should be configured to vary by culture (or another variant property), and the other should not vary.
- Set Up Languages: Make sure you have multiple languages set up in your Umbraco installation. This is crucial for demonstrating the variant-specific behavior.
- Create Content: Create content nodes based on both of your Document Types. This gives you something to save and publish.
- Simulate Slow Network: Open your browser's developer tools (usually by pressing F12). Find the "Network" tab and enable network throttling. Set it to something like "3G" to simulate a slower internet connection. This will make the save process take longer and highlight the missing indicator.
- Save & Publish (Non-Varying): Select the content node that does not vary. Click "Save & Publish." Notice the delightful spinning progress indicator on the button. This is what we want to see!
- Save & Publish (Varying): Now, select the content node that does vary. Click "Save & Publish." When the modal appears, choose the languages you want to publish. Notice the distinct lack of a spinning indicator. Uh oh!
Expected vs. Actual
Expected Result: When you hit "Save" or "Save & Publish" on a page with variants, the button should display a spinning progress indicator to show that the action is in progress. Basically, we expect the same behavior as when saving non-varying content.
Actual Result: Nada. Nothing. Zilch. The button remains stubbornly static, leaving you in the dark about what's happening.
Why This Happens
So, why is this happening? While I can't pinpoint the exact line of code causing this, it likely boils down to how Umbraco handles the save/publish process for variants versus non-variants. It's possible that the event triggering the visual indicator isn't being correctly fired or handled when dealing with variant-specific save operations. Maybe there's a different code path being taken, or perhaps a callback function isn't being executed as expected.
Possible Solutions and Workarounds
Alright, so we know the problem. What can we do about it? Here are a few ideas:
Community Contribution
The best long-term solution is to contribute to the Umbraco core. If you're a developer, dig into the Umbraco source code and identify the root cause of this issue. Then, submit a pull request with a fix. This ensures that the problem is resolved for everyone in future releases.
Custom JavaScript
As a temporary workaround, you could use custom JavaScript to add a visual indicator. Here's the basic idea:
- Hook into the Save Event: Find the JavaScript event that's triggered when the "Save" or "Save & Publish" button is clicked.
- Add a Spinner: Use JavaScript to dynamically add a spinner element to the button or a nearby area on the page.
- Remove the Spinner: When the save operation completes (you'll need to find a way to detect this, possibly by hooking into the Umbraco API), remove the spinner.
This is a bit of a hacky solution, but it can provide immediate relief for your content editors.
Examine the Console
When you hit save, open the browser console to see any errors being logged. If you see errors, this could give you clues as to what the cause is and it can help you find a workaround.
Communicate with Your Editors
In the meantime, make sure to communicate the issue to your content editors. Let them know that saving might take a while and that the lack of a spinner doesn't necessarily mean something is broken. This can help manage their expectations and reduce frustration.
Wrapping Up
The missing visual indicator when saving content variants in Umbraco is a small but significant issue that can impact user experience and confidence. While we wait for a permanent fix, consider using the workarounds discussed above to provide some reassurance to your content editors. And, if you're a developer, consider contributing to the Umbraco community by helping to identify and fix the root cause of this problem. Together, we can make Umbraco even better!