@simmalugnt-se/payload-editor-assistant 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.3
4
+
5
+ - Clicking "Fix N with the assistant" again after closing the panel opens it on the batch that is
6
+ still there. The link was remembered as taken and did nothing.
7
+
3
8
  ## 0.11.2
4
9
 
5
10
  - Translating a page whose text is all inside blocks or rows now works. The assistant left the
@@ -17,11 +17,13 @@ export function releaseTakenBatches() {
17
17
  export function useBatchLink() {
18
18
  const params = useSearchParams();
19
19
  const { setBatch, setOpen } = useAssistantState();
20
- const value = params?.get(BATCH_PARAM);
20
+ // Depends on `params`, not the value: the same batch clicked twice leaves the value unchanged.
21
21
  useEffect(() => {
22
- if (!value || taken.has(value)) {
22
+ const value = params?.get(BATCH_PARAM);
23
+ if (!value) {
23
24
  return;
24
25
  }
26
+ const repeated = taken.has(value);
25
27
  taken.add(value);
26
28
  const url = new URL(window.location.href);
27
29
  const targets = parseBatchTargets(url.searchParams.get(BATCH_PARAM));
@@ -31,9 +33,14 @@ export function useBatchLink() {
31
33
  url.searchParams.delete(name);
32
34
  }
33
35
  window.history.replaceState(window.history.state, "", url.toString());
36
+ if (repeated) {
37
+ // The batch is still in the panel, which the editor closed: show it again.
38
+ setOpen(true);
39
+ return;
40
+ }
34
41
  if (targets.length > 0 && prompt) {
35
42
  setBatch({ id: crypto.randomUUID(), targets, scope, prompt });
36
43
  setOpen(true);
37
44
  }
38
- }, [value, setBatch, setOpen]);
45
+ }, [params, setBatch, setOpen]);
39
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simmalugnt-se/payload-editor-assistant",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Context-aware editor assistant plugin for Payload Admin",
5
5
  "keywords": [
6
6
  "payload",