Commit Graph

9755 Commits

Author SHA1 Message Date
Elena Torró
486a08189e Merge pull request #8811 from penpot/alotor-fix-position-data
🐛 Fix problem with position data in new render
2026-03-27 12:06:07 +01:00
Andrey Antukh
d67c7f1c8e Add retry mechanism for idenpotent get repo requests on frontend (#8792)
* ♻️ Handle fetch-error gracefully with toast instead of full-page error

Network-level failures (lost connectivity, DNS failure, etc.) on RPC
calls were propagating as :internal/:fetch-error to the global error
handler, which replaced the entire UI with a full-page error screen.

Now the :internal handler distinguishes :fetch-error from other internal
errors and shows a non-intrusive toast notification instead, allowing
the user to continue working.

*  Add automatic retry with backoff for idempotent RPC requests

Idempotent (GET) RPC requests are now automatically retried up to 3
times with exponential back-off (1s, 2s, 4s) when a transient error
occurs.  Retryable errors include: network-level failures
(:fetch-error), 502 Bad Gateway, 503 Service Unavailable, and browser
offline (status 0).

Mutation (POST) requests are never retried to avoid unintended
side-effects.  Non-transient errors (4xx client errors, auth errors,
validation errors) propagate immediately without retry.

* ♻️ Make retry helpers public with configurable parameters

Make retryable-error? and with-retry public functions, and replace
private constants with a default-retry-config map.  with-retry now
accepts an optional config map (:max-retries, :base-delay-ms) enabling
callers and tests to customize retry behavior.

*  Add tests for RPC retry mechanism

Comprehensive tests for the retry helpers in app.main.repo:
- retryable-error? predicate: covers all retryable types (fetch-error,
  bad-gateway, service-unavailable, offline) and non-retryable types
  (validation, authentication, authorization, plain errors)
- with-retry observable wrapper: verifies immediate success, recovery
  after transient failures, max-retries exhaustion, no retry for
  non-retryable errors, fetch-error retry, custom config, and mixed
  error scenarios

* ♻️ Introduce :network error type for fetch-level failures

Replace the awkward {:type :internal :code :fetch-error} combination
with a proper {:type :network} type in app.util.http/fetch.  This makes
the error taxonomy self-explanatory and removes the special-case branch
in the :internal handler.

Consequences:
- http.cljs: emit {:type :network} instead of {:type :internal :code :fetch-error}
- errors.cljs: add a dedicated ptk/handle-error :network method (toast);
  restore :internal handler to its original unconditional full-page error form
- repo.cljs: simplify retryable-types and retryable-error? — :network
  replaces the former :internal special-case, no code check needed
- repo_test.cljs: update tests to use {:type :network}

* 📚 Add comment explaining the use of bit-shift-left
2026-03-27 11:10:26 +01:00
Alejandro Alonso
8db63c9770 Merge pull request #8785 from penpot/ladybenko-fix-repeatable-key
🐛 Fix repeateable keys triggering an infinite React loop in text editor v2
2026-03-27 10:17:44 +01:00
Alejandro Alonso
0da6b87b5f 🎉 Allow get param to set antialias threshold 2026-03-27 10:00:54 +01:00
alonso.torres
f3b762855b 🐛 Fix problem with position data in new render 2026-03-27 09:29:28 +01:00
Belén Albeza
85425e2ccd 🐛 Fix repeateable keys triggering an infinite React loop in text editor v2 2026-03-26 13:17:09 +01:00
Elena Torro
1641eec672 🎉 Add stroke to path 2026-03-26 11:43:06 +01:00
alonso.torres
6e03a191a3 🐛 Fix return type for combineAsVariants methods 2026-03-26 09:37:31 +01:00
Luis de Dios
a7e3d7963a 🐛 Fix do not manage tab notifications when MCP flag is disabled 2026-03-26 09:37:24 +01:00
alonso.torres
52a576dc4d 🐛 Fix problem with fills in text range 2026-03-26 09:14:50 +01:00
andrés gonzález
1740d2e3d1 🌐 Differentiate MCP key copy from access token copy (#8786) 2026-03-26 08:21:44 +01:00
Alejandro Alonso
811d53be12 Merge remote-tracking branch 'origin/main' into staging 2026-03-25 18:27:22 +01:00
andrés gonzález
a60020ea98 💄 Change link from Integrations to MCP docs (#8784) 2026-03-25 18:07:37 +01:00
alonso.torres
28b4c14b95 🐛 Fix problem when removing margin 2026-03-25 13:28:56 +01:00
Eva Marco
ba8b552df2 🐛 Fix shared button variant and title (#8696)
Co-authored-by: Luis de Dios <luis.dedios@kaleidos.net>
2026-03-25 13:08:41 +01:00
Andrey Antukh
a2672a598c 🐛 Fix TypeError when token error map lacks :error/fn key (#8767)
* 🐛 Fix TypeError when token error map lacks :error/fn key

Guard against missing :error/fn in token form control resolve streams.
When schema validation errors are produced they may not carry an
:error/fn key; calling nil as a function caused a TypeError crash.
Apply an if-let guard at all 7 affected sites across input.cljs,
color_input.cljs and fonts_combobox.cljs, falling back to :message
or returning the error map unchanged.

* ♻️ Extract token error helpers and add unit tests

Extract resolve-error-message and resolve-error-assoc-message helpers
into errors.cljs, replacing the seven duplicated inline lambdas in
input.cljs, color_input.cljs and fonts_combobox.cljs with named
function references.  Add frontend-tests.tokens.token-errors-test
covering both helpers for the normal path (:error/fn present) and the
fallback path (schema-validation errors that lack :error/fn).

Signed-off-by: Penpot Dev <dev@penpot.app>

---------

Signed-off-by: Penpot Dev <dev@penpot.app>
2026-03-25 12:12:18 +01:00
Alejandro Alonso
6268a8aaf1 Merge pull request #8764 from penpot/alotor-fix-issue-text-sizing
🐛 Fix resize text modifiers
2026-03-25 07:45:25 +01:00
alonso.torres
6b609566e1 🐛 Fix resize text modifiers 2026-03-25 07:29:20 +01:00
Andrey Antukh
0dfac801a4 Improve error handling and exception formatting (#8757)
*  Improve error handling and exception formatting

- Enhance exception formatting with visual separators and cause chaining
- Add new handler for :internal error type
- Refine error types: change assertion-related errors to :assertion type
- Improve error messages and hints consistency
- Clean up error handling in zip utilities and HTTP modules

* 🐛 Properly handle AbortError on fetch request unsubscription

When a fetch request in-flight is cancelled due to RxJS unsubscription
(e.g. navigating away from the workspace while thumbnail loads are
pending), the AbortController.abort() call triggers a catch handler
that previously relied solely on a @unsubscribed? flag to suppress the
error.

This was unreliable: nested observables spawned inside rx/mapcat (such
as datauri->blob-uri conversions within get-file-object-thumbnails)
could abort independently, with their own AbortController instances,
meaning the outer unsubscribed? flag was never set and the AbortError
propagated as an unhandled exception.

Add an explicit AbortError name check as a disjunctive condition so
that abort errors originating from any observable in the chain are
suppressed at the source, regardless of subscription state.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-24 19:55:23 +01:00
Andrey Antukh
01284e2a00 Improve error handling and exception formatting (#8757)
*  Improve error handling and exception formatting

- Enhance exception formatting with visual separators and cause chaining
- Add new handler for :internal error type
- Refine error types: change assertion-related errors to :assertion type
- Improve error messages and hints consistency
- Clean up error handling in zip utilities and HTTP modules

* 🐛 Properly handle AbortError on fetch request unsubscription

When a fetch request in-flight is cancelled due to RxJS unsubscription
(e.g. navigating away from the workspace while thumbnail loads are
pending), the AbortController.abort() call triggers a catch handler
that previously relied solely on a @unsubscribed? flag to suppress the
error.

This was unreliable: nested observables spawned inside rx/mapcat (such
as datauri->blob-uri conversions within get-file-object-thumbnails)
could abort independently, with their own AbortController instances,
meaning the outer unsubscribed? flag was never set and the AbortError
propagated as an unhandled exception.

Add an explicit AbortError name check as a disjunctive condition so
that abort errors originating from any observable in the chain are
suppressed at the source, regardless of subscription state.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-24 19:54:05 +01:00
Andrey Antukh
8928e274fc Merge remote-tracking branch 'origin/main' into staging 2026-03-24 18:01:38 +01:00
alonso.torres
b6e300a6c7 🐛 Fix plugins addToken schema validation 2026-03-24 16:27:59 +01:00
Andrey Antukh
750e8a9d51 🐛 Fix dissoc error when detaching stroke color from library (#8738)
* 🐛 Fix dissoc error when detaching stroke color from library

The detach-value function in color-row was only passing index to
on-detach, but the stroke's on-color-detach handler expects both
index and color arguments. This caused a protocol error when trying
to dissoc from a number instead of a map.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>

* 🐛 Fix crash when detaching color asset from stroke

The color_row detach-value callback calls on-detach with (index, color),
but stroke_row's local on-color-detach wrapper only took a single argument
(fn [color] ...), so it received index as color and passed it to
stroke.cljs which then called (dissoc index :ref-id :ref-file), crashing
with 'No protocol method IMap.-dissoc defined for type number'.

Fix the wrapper to accept (fn [_ color] ...) so it correctly ignores the
index passed by color_row (it already has index in the closure) and
forwards the actual color map to the parent handler.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>

---------

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-24 15:35:32 +01:00
Andrey Antukh
56f1fcdb53 🐛 Fix crash when pasting image into text editor
When pasting an image (with no text content) into the text editor,
Draft.js calls handlePastedText with null/empty text. The previous fix
guarded splitTextIntoTextBlocks against null, but insertText still
attempted to build a fragment from an empty block array, causing
Modifier.replaceWithFragment to crash with 'Cannot read properties of
undefined (reading getLength)'.

Fix insertText to return the original state unchanged when there are no
text blocks to insert. Also guard handle-pasted-text in the ClojureScript
editor to skip the insert-text call entirely when text is nil or empty.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-24 13:00:28 +00:00
Alejandro Alonso
ca427bcd4e Merge pull request #8728 from penpot/niwinz-staging-dom-remove-child-issue
🐛 Fix removeChild crash on all portal components
2026-03-24 13:16:32 +01:00
Alejandro Alonso
5d6eb3b3d6 Merge pull request #8739 from penpot/niwinz-main-bugfix-5
🐛 Fix error when get-parent-with-data encounters non-Element nodes
2026-03-24 12:50:48 +01:00
Aitor Moreno
c3a0189af2 Merge pull request #8746 from penpot/superalex-fix-backspace-breaks-ctrl-z
🐛 Fix backspace breaks ctrl z
2026-03-24 12:27:19 +01:00
Luis de Dios
5f722d9183 🐛 Fix show red bullet in workspace menu if mcp key is expired (#8727) 2026-03-24 12:27:09 +01:00
Elena Torro
5a73003c7f 🐛 Fix fallback fonts and symbols 2 2026-03-24 12:06:28 +01:00
Alejandro Alonso
0c6736e676 Merge pull request #8737 from penpot/alotor-export-wasm
🐛 Fix problem with multiple export
2026-03-24 11:36:12 +01:00
alonso.torres
937032c790 Allow for reconnections to MCP server 2026-03-24 11:32:47 +01:00
Eva Marco
dd6a3c291a 🐛 Fix tooltip shown on tab change (#8719) 2026-03-24 11:22:52 +01:00
Alejandro Alonso
55d763736f 🐛 Fix backspace breaks ctrl+z 2026-03-24 11:19:02 +01:00
Andrey Antukh
d051a3ba45 🐛 Ensure path content is always PathData when saving
The save-path-content function only converted content to PathData when
there was a trailing :move-to command. When there was no trailing
:move-to, the content from get-path was stored as-is, which could be
a plain vector if the shape was already a :path type with non-PathData
content. This caused segment/get-points to fail with 'can't access
property "get", cache is undefined' when the with-cache macro tried
to access the cache field on a non-PathData object.

The fix ensures content is always converted to PathData via path/content
before being stored in the state.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-24 08:15:58 +01:00
Andrey Antukh
577f00dd24 🐛 Fix error when get-parent-with-data encounters non-Element nodes
The get-parent-with-data function traverses the DOM using parentElement
to find an ancestor with a specific data-* attribute. When the current
node is a non-Element DOM node (e.g. Document node reached from event
handlers on window), accessing .-dataset returns undefined, causing
obj/in? to throw "right-hand side of 'in' should be an object".

This adds a nodeType check to skip non-Element nodes during traversal
and continue up the parent chain.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-23 19:19:27 +00:00
Andrey Antukh
b484415a9f 🐛 Fix generic error shown on clipboard permission denial (#8666)
When the browser denies clipboard read permission (NotAllowedError),
the unhandled exception handler was showing a generic 'Something wrong
has happened' toast. This change adds proper error handling for
clipboard permission errors in paste operations and shows a
user-friendly warning message instead.

Changes:
- Add error handling in paste-from-clipboard for NotAllowedError
- Improve error handling in paste-selected-props to detect permission errors
- Mark clipboard NotAllowedError as ignorable in the uncaught error handler
  to prevent duplicate generic error toasts
- Add translation key for clipboard permission denied message

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-23 20:03:14 +01:00
alonso.torres
43be994920 🐛 Fix problem with multiple export 2026-03-23 19:51:20 +01:00
alonso.torres
13ee27b1ad 🐛 Fix problem with plugins export 2026-03-23 15:40:15 +01:00
Andrey Antukh
2905905a9f ♻️ Extract use-portal-container hook to reduce duplication
The dedicated-container portal pattern was repeated across 7 components.
Extract it into a reusable use-portal-container hook under app.main.ui.hooks.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-23 13:47:33 +00:00
Andrey Antukh
ff60503ce6 🐛 Fix removeChild crash on all portal components
The previous fix (80b64c440c) only addressed portal-on-document* but
there were 6 additional components that portaled directly to
document.body, causing the same race condition when React attempted
to remove a node that had already been detached during concurrent
state updates (e.g. navigating away while a context menu is open).

Apply the dedicated-container pattern consistently to all portal
sites: modal, context menus, combobox dropdown, theme selector, and
tooltip. Each component now creates a dedicated <div> container
appended to body on mount and removed on cleanup, giving React an
exclusive containerInfo for each portal instance.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
2026-03-23 14:19:57 +01:00
Alejandro Alonso
0c3b5895bf 🐛 Restore correct branches in finalize-editor-state for text 2026-03-20 17:00:34 +01:00
Alejandro Alonso
dd10be1fb4 Merge pull request #8611 from penpot/alotor-export-wasm
 Add support for export with wasm engine
2026-03-20 11:59:03 +01:00
alonso.torres
7a8824b826 Add support for export with wasm engine 2026-03-20 09:46:19 +01:00
Alejandro Alonso
1126ed37f1 🐛 Coerce finalize? in WASM text updates for valid undo flags 2026-03-20 09:43:00 +01:00
Alejandro Alonso
353d8677b0 🐛 Fix WASM text auto-width geometry on finalize 2026-03-20 09:28:28 +01:00
Aitor Moreno
58d959a37e Merge pull request #8684 from penpot/superalex-fix-embedded-editor-pasting-text-2
🐛 Fix embedded editor pasting text
2026-03-20 06:52:39 +01:00
Luis de Dios
e870497ae1 📎 PR changes 2026-03-19 16:39:29 +01:00
Luis de Dios
9e9c28fe3c 🐛 Fix MCP notifications when there is only one tab 2026-03-19 16:39:29 +01:00
alonso.torres
a1a469449e Add throwValidationErrors flag for plugins 2026-03-19 15:37:08 +01:00
Alejandro Alonso
0499cd6162 Merge pull request #8654 from penpot/elenatorro-13282-perf-tiles
🔧 Preserve cache canvas during tile rebuild for smooth zoom preview
2026-03-19 15:20:08 +01:00