parse-community / parse-community/parse-server

Make it possible to skip triggers

Open
#7,059 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

Is your feature request related to a problem? Please describe.
When I'm writing tests I would like to be able to skip triggers.
For example, if I do some security check on my triggers I need to match with that on my test, and sometime it's very annoying because the objective is not to test the trigger, but something else. So it will be very useful to skip them.

Describe the solution you'd like
I see 2 major possibilities:

  1. Add an option which can be pass (as a context) on actions
object.save( { skip_before_save: true, skip_after_save: true } );
  1. Use the context to simulate the skipping
object.save( { context: { skip_before_save: true, skip_after_save: true } } );

Parse.Cloud.beforeSave("myClass", async (request) => {
   if request.context.skip_before_save == false {
      // do some work
   }
});

Parse.Cloud.afterSave("myClass", async (request) => {
   if request.context.skip_after_save == false {
      // do some work
   }
});

The second solution only required that the context can be used on every triggers - #7058 - but it don't really skip the trigger.
So I definitely think that the first one can be the best option (or something else in the same spirit).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the trigger execution and action-handling paths in parse-server, then compare the proposed action option with the context-based approach from issue #7058. Define the supported skip behavior and its scope before adding coverage for beforeSave and afterSave triggers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.